Mr Mat psql-mail <psql-mail@freeuk.com> writes:
> I have now gone back to my original query shown below:
> SELECT msg_id, from_line, col_date FROM news_messages WHERE msg_id IN(
> SELECT msg_id FROM news_msg_id_ng_id_link WHERE ng_id IN(
> SELECT ng_id FROM news_ng_genre_link WHERE genre_id in (3,6)
> )
> )
I think all you can do with this is transform the outer IN into EXISTS
and make sure there's an index on news_msg_id_ng_id_link.msg_id. See
the FAQ item about slow IN's for details.
7.4 will do this a lot better, but for now you need a workaround...
regards, tom lane