Subject | Re: [firebird-support] Query Performance - correlated subqueries and group by statements |
---|---|
Author | Alexandre Benson Smith |
Post date | 2005-04-15T17:51:29Z |
Aaron Abend wrote:
set the cache page value to a maximum of 10000.
FB 1.5 and earlier have a not so good algorithm to handle a large number
of page buffers.
FB 2.0 removed this limit.
Can you change your correlated sub-queries to joins ? You will be amazed
by the performance diference.
example:
Select
Costumer.Name, Costumer.FirstSale
from
Costumer
where
Costumer.CityId in (select CityID from City where state = 'NY')
tend to be slow.
but
Select
Costumer.Name, Costumer.FirstSale
from
Costumer join
City on (City.CityID = Customer.CityID)
where
City.State = 'NY'
will be much faster !
--
Alexandre Benson Smith
Development
THOR Software e Comercial Ltda.
Santo Andre - Sao Paulo - Brazil
www.thorsoftware.com.br
>I set DefaultDbCachePages to a high (probably ridiculous) number - 40,000.Don't do it !
>FBServer is now using 50M, which is actually about where I want it. I
>believe the page size is the default. Could changing that help?
>
>
>
set the cache page value to a maximum of 10000.
FB 1.5 and earlier have a not so good algorithm to handle a large number
of page buffers.
FB 2.0 removed this limit.
>Question: Does FB2.0 do anything new with correlated subqueries? We haveAFAIK no.
>tested by manually determining inner values and found that the individual
>queries are taking nanoseconds, but when the whole thing is put together as
>a correlated query, it tanks.
>
>
>
Can you change your correlated sub-queries to joins ? You will be amazed
by the performance diference.
example:
Select
Costumer.Name, Costumer.FirstSale
from
Costumer
where
Costumer.CityId in (select CityID from City where state = 'NY')
tend to be slow.
but
Select
Costumer.Name, Costumer.FirstSale
from
Costumer join
City on (City.CityID = Customer.CityID)
where
City.State = 'NY'
will be much faster !
>I will post our discoveries on this, or the code, depending on what wesee you !
>learn.
>
>Thanks,
>
>Aaron Abend
>
>
--
Alexandre Benson Smith
Development
THOR Software e Comercial Ltda.
Santo Andre - Sao Paulo - Brazil
www.thorsoftware.com.br