In kabul_cikis, there are 47000 rows.
I have indexes on those fields. 
I just added compaund index also.

Result is same.

When I run queries one by one: I mean in(...) query:

select basvuru_fk 
from kabul_cikis 
where iptal < 1 
group by basvuru_fk having MIN(cikis_zmn)> ' '

Result is : 44048 rows fetched in 0,08s

select k.*, b.sgk_statu
from kabul_cikis k, basvuru b
where k.basvuru_fk = b.id
and k.sosguvsnf = 1
and k.iptal < 1
and b.id between 1 and 50655
and k.devrkurum <> '4';

Result is : 40867 rows fetched in 1,36s.

But when together, infinite time.

Same query run in vfp and mssql in few seconds.


-----Original Message-----
From: [email protected] [mailto:[email protected]] On 
Behalf Of Stephen Russell
Sent: Wednesday, October 07, 2009 5:24 PM
To: [email protected]
Subject: Re: MySql query speed

On Wed, Oct 7, 2009 at 9:00 AM, Ali İhsan Türkoğlu <[email protected]> wrote:
> I am new on MySql.
>
> I run the below query in MySql Query Browse. Althought I wait more than 10
> minutes, not reached the result.
>
> Please help what is wrong with my guery.
>
>
>
> select k.*,  b.sgk_statu
>
> from kabul_cikis k, basvuru b
>
> where k.basvuru_fk = b.id
>
> and k.sosguvsnf = 1
>
> and k.iptal < 1
>
> and b.id between 1 and 50655
>
> and b.id in( select basvuru_fk from kabul_cikis where iptal < 1 group by
> basvuru_fk having MIN(cikis_zmn)> ' ')
>
> and k.devrkurum <> '4';
--------------------------------------

You will need a compound index
kabul_cikis    basvuru_fk and devrkurum and iptal and cikis_zmn

How many rows are in kabul_cikis?

You are probably getting hit hard here  MIN(cikis_zmn)> ' '

HTH
-- 
Stephen Russell
Sr. Production Systems Programmer
SQL Server DBA
Web and Winform Development
Independent Contractor
Memphis TN

901.246-0159


[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/000001ca475d$50f5ff30$f2e1fd...@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.

Reply via email to