首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >需要优化此查询

需要优化此查询
EN

Stack Overflow用户
提问于 2010-10-14 17:51:38
回答 1查看 77关注 0票数 1

我有一个任务来优化这个查询,任何想法都将不胜感激。

代码语言:javascript
复制
SELECT DISTINCT `br`.`id` AS `branch_id`
       , `br`.`store_id`
       , `br`.`longitude`
       , `br`.`latitude`
       , `br`.`town_id`
       , `br`.`post_region`
       , `cb`.`cat0_id`
       , `cb`.`cat1_id`
       , `cb`.`cat2_id`
       , `plan`.`listing_plan_id`
       , `cat0`.`cat_topid`
       , `cg`.`tarrif` 
FROM   `mvcl_local_new`.`branch` AS `br`
       INNER JOIN `mvcl_local_new`.`voucher_branch` AS `vb` ON br.id = vb.branch_id
       INNER JOIN `mvcl_local_new`.`voucher` AS `v` ON v.id = vb.voucher_id
       INNER JOIN `category_voucher` AS `cb` ON cb.voucher_id = v.id
       INNER JOIN `category_voucher_listing_plans` AS `plan` ON plan.voucher_id = v.id
       INNER JOIN `category_level0` AS `cat0` ON cb.cat0_id = cat0.id
       LEFT JOIN `category_tariffs` AS `cg` ON cg.voucher_id = v.id 
WHERE  (
        br.latitude != 0 
        and br.longitude != 0 
        and br.post_region <> ''
        and valid_from < 1286876423 
        and expires > 1286876423
        and 
        (
            (
                plan.listing_plan_id IN (1,2,3) 
                and cg.town_id = br.town_id 
                and cg.is_active = 1 
                and cg.status_code='Active' 
                and cg.tarrif_id=0
            )
            or plan.listing_plan_id=4
        )
    );
EN

回答 1

Stack Overflow用户

发布于 2010-10-14 21:24:47

对于优化查询,在dbForge Studio For MySQL中使用MySQL事件探查器非常方便。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/3931968

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档