Subject | Re: Performance troubles |
---|---|
Author | Ali Gökçen |
Post date | 2005-10-27T11:24:50Z |
Hi,
is there index on sate? if not, FB will read all contacts * related
gifts.
is there too much gifts for a contact? if so index on someotherfield
will help for performance.
if indexes ok, this shouldnt be took several hours:
select contactno from contacts c
where state in(1,2)
exists(select sum(giftvalue)
from gifts
where contactno = c.contactno
and someotherfield = 'somevalue'
having sum(giftvalue)>=100
)
Regards.
Ali
> select contactno from contacts cc.contactno
> where
> state in (1,2)
> and
> (select sum(giftvalue) from gifts g where g.contactno =
> and someotherfield = 'somvalue') >= 100several hours too much for this query, it shouldn't took so much.
>
> This takes several hours (contacts haves about 55,000 record and
is there index on sate? if not, FB will read all contacts * related
gifts.
is there too much gifts for a contact? if so index on someotherfield
will help for performance.
if indexes ok, this shouldnt be took several hours:
select contactno from contacts c
where state in(1,2)
exists(select sum(giftvalue)
from gifts
where contactno = c.contactno
and someotherfield = 'somevalue'
having sum(giftvalue)>=100
)
Regards.
Ali