Re: [PERFORM] Simple indexed IN query takes 40 seconds

2008-11-10 Thread Andrus
Tom, Using something newer than 8.1 would help. Thank you. If CREATE TEMP TABLE ids ( id int ) ON COMMIT DROP; is created, ids are added to this table and ids table is used in inner join insted of IN clause or IN clause is replaced with ... dokumnr IN ( SELECT id FROM ids ) ... , w

Re: [PERFORM] Simple indexed IN query takes 40 seconds

2008-11-10 Thread tv
Obviously, most of the total cost (cost=327569, time=39749ms) comes from two operations in the execution plan: (a) sequential scan on the 'rid' table (cost=195342, time=26347ms) that produces almost 3.200.000 rows (b) hash join of the two subresults (cost=24, time=14000ms) How many rows are t

Re: [PERFORM] Simple indexed IN query takes 40 seconds

2008-11-10 Thread Tom Lane
"Andrus" <[EMAIL PROTECTED]> writes: > How to make this query to run fast ? Using something newer than 8.1 would help. regards, tom lane -- Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgre

[PERFORM] Simple indexed IN query takes 40 seconds

2008-11-10 Thread Andrus
I found that simple IN query on indexed tables takes too much time. dok and rid have both indexes on int dokumnr columnr and dokumnr is not null. PostgreSql can use index on dok or event on rid so it can executed fast. How to make this query to run fast ? Andrus. note: list contain a lot o