When I write EXPLAIN keyword to the beginning of the select statment, I get:
select `k`.`id` AS `id`,`k`.`kayit_fk` AS `kayit_fk`,`k`.`kabul_yeri` AS `kabul_yeri`,`k`.`kabul_zmn` AS `kabul_zmn`,`k`.`kabul_sekl` AS `kabul_sekl`,`k`.`sevk_trh` AS `sevk_trh`,`k`.`geld_polk` AS `geld_polk`,`k`.`vaka_turu` AS `vaka_turu`,`k`.`sgk_takipn` AS `sgk_takipn`,`k`.`cikis_sekl` AS `cikis_sekl`,`k`.`cikis_zmn` AS `cikis_zmn`,`k`.`svkedl_plk` AS `svkedl_plk`,`k`.`hekim_fk` AS `hekim_fk`,`k`.`sgk_yknlk` AS `sgk_yknlk`,`k`.`sigortturu` AS `sigortturu`,`k`.`sosguvsnf` AS `sosguvsnf`,`k`.`devrkurum` AS `devrkurum`,`k`.`kurum_fk` AS `kurum_fk`,`k`.`ozkurum_fk` AS `ozkurum_fk`,`k`.`takipturu` AS `takipturu`,`k`.`sorguturu` AS `sorguturu`,`k`.`taburcukod` AS `taburcukod`,`k`.`istisnadrm` AS `istisnadrm`,`k`.`tdv_sekli` AS `tdv_sekli`,`k`.`basim_zmn` AS `basim_zmn`,`k`.`kabul_mik` AS `kabul_mik`,`k`.`ilktakipno` AS `ilktakipno`,`k`.`takiptipi` AS `takiptipi`,`k`.`tedavi_tur` AS `tedavi_tur`,`k`.`tedavitipi` AS `tedavitipi`,`k`.`donortckno` AS `donortckno`,`k`.`basvuruno` AS `basvuruno`,`k`.`basvuru_fk` AS `basvuru_fk`,`k`.`icmal_fk` AS `icmal_fk`,`k`.`sgk_tutar` AS `sgk_tutar`,`k`.`hzmkayit` AS `hzmkayit`,`k`.`evrak_trh` AS `evrak_trh`,`k`.`evrak_no` AS `evrak_no`,`k`.`iptal` AS `iptal`,`k`.`kullanc_fk` AS `kullanc_fk`,`b`.`sgk_statu` AS `sgk_statu` from `kabul_cikis` `k` join `basvuru` `b` where ( (`b`.`id` = `k`.`basvuru_fk`) and (`k`.`sosguvsnf` = 1) and (`k`.`iptal` < 1) and (`k`.`basvuru_fk` between 1 and 50655) and <in_optimizer>(`k`.`basvuru_fk`,<exists>(select `kabul_cikis`.`basvuru_fk` AS `basvuru_fk` from `kabul_cikis` where (`kabul_cikis`.`iptal` < 1) group by `kabul_cikis`.`basvuru_fk` having ((min(`kabul_cikis`.`cikis_zmn`) > _utf8' ') and (<cache>(`b`.`id`) = <ref_null_helper>(`kabul_cikis`.`basvuru_fk`))))) and (`k`.`devrkurum` <> _utf8'4') ) -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of MB Software Solutions, LLC Sent: Wednesday, October 07, 2009 6:43 PM To: [email protected] Subject: Re: MySql query speed Stephen Russell wrote: > On Wed, Oct 7, 2009 at 9:29 AM, Paul McNett <[email protected]> wrote: >> Stephen Russell wrote: >>> You will need a compound index >>> kabul_cikis basvuru_fk and devrkurum and iptal and cikis_zmn >> CREATE INDEX kabul_cikis_fk_devrkurum_iptal_cicis_zmn ON kabul_cikis (fk, devrkurum, >> iptal, cikis_zmn); > -------------------------------- > > In MySQL can you give a nint to the index you want used? It may still > pick up the plain Jane index on FK and not consider the new one. > Look into the EXPLAIN option too to help you see what is optimized and what's not. -- Mike Babcock, MCP MB Software Solutions, LLC President, Chief Software Architect http://mbsoftwaresolutions.com http://fabmate.com http://twitter.com/mbabcock16 [excessive quoting removed by server] _______________________________________________ Post Messages to: [email protected] Subscription Maintenance: http://leafe.com/mailman/listinfo/profox OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech Searchable Archive: http://leafe.com/archives/search/profox This message: http://leafe.com/archives/byMID/profox/000601ca4779$58f6e1b0$0ae4a5...@com ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.

