Re: [HACKERS] subselect and optimizer - Mailing list pgsql-hackers

From Igor Sysoev
Subject Re: [HACKERS] subselect and optimizer
Date
Msg-id 199804220739.LAA24749@ns.nitek.ru
Whole thread Raw
List pgsql-hackers
Vadim wrote:

> BTW, IN is slow (currently :) - try to create 2-key index on bik (bik,
newkey)
> and rewrite your query as
>
> select * from bik b1 where EXISTS (select newkey from bik where
> bik = '....' and b1.key = newkey)
>
> And let's know... (Note, that index on (newkey, bik) may be more useful
> than on (bik, newkey) - it depends on your data).

I had tried - it really works ! I don't even try to use index for bik
(bik).
It works even when I tried "bik ~ '...'".
The one downside is I need to crunch and twist my brains to use
such SQL statemants :). Thank you.

Igor Sysoev

pgsql-hackers by date:

Previous
From: "Igor Sysoev"
Date:
Subject: Re: [HACKERS] subselect and optimizer
Next
From: "Jose' Soares Da Silva"
Date:
Subject: Re: [QUESTIONS] errors on transactions and locks ?