On 31 Srpen 2011, 13:19, Jayadevan M wrote: > Hello, > >> > >> > Please run EXPLAIN ANALYZE on the query and post that, it's hard to > say >> > what's wrong from just the query plan, without knowing where the time > is >> > actually spent. >> Here is the explain analyze >> http://explain.depesz.com/s/MY1 > Going through the url tells me that statistics may be off. I will try > analyzing the tables. That should help? > Regards, > Jayadevan That could help, but not necessarily. A really interesting part is the sort near the bottom - -> Sort (cost=1895.95..1896.49 rows=215 width=61) (actual time=25.926..711784.723 rows=2673340321 loops=1) Sort Key: memmst.memshpsta Sort Method: quicksort Memory: 206kB -> Nested Loop (cost=0.01..1887.62 rows=215 width=61) (actual time=0.088..23.445 rows=1121 loops=1) How can a sort ge 1121 rows at the input and return 2673340321 rows at the output? Not sure where this comes from. BTW what PostgreSQL version is this? Tomas -- Sent via pgsql-performance mailing list (pgsql-performance@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance