select s.id,s.name,p.price,m.name as clientname,m.register_address,z.img_source from cl_product_i18n s,cl_product n,t_mdm_client m,
cl_category_product_rel t,pr_price p,cl_product_address d,cl_product_image z
where s.id=p.product_id and s.id=z.product_id and d.product_id=s.id and t.product_id=s.id and n.id=s.id and m.id=n.merchant_id
and p.price_type='" + PriceTypeEnum.SALE_PRICE +"' and p.sale_channel=2 and t.catalog_id=150 and s.id='"+productId+"';
怎么在多表查询中建立索引,实现效率的提高,谢谢。
- 写回答
- 好问题 0 提建议
- 追加酬金
- 关注问题
- 邀请回答
-
1条回答
- Tiger_Zhao 2015-07-13 05:40关注
每个表出现在条件中的字段上建索引。如果一个表同时用到多个字段,数据库支持索引包含就用包含(如下),否则就建在一个索引中。
pr_price(product_id)包含(price_type,sale_channel) cl_category_product_rel(product_id)包含(catalog_id)
解决 无用评论 打赏 举报
悬赏问题
- ¥15 素材场景中光线烘焙后灯光失效
- ¥15 请教一下各位,为什么我这个没有实现模拟点击
- ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
- ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
- ¥20 有关区间dp的问题求解
- ¥15 多电路系统共用电源的串扰问题
- ¥15 slam rangenet++配置
- ¥15 有没有研究水声通信方面的帮我改俩matlab代码
- ¥15 ubuntu子系统密码忘记
- ¥15 保护模式-系统加载-段寄存器