Re: [PERFORM] Slow SQL lookup due to every field being listed in SORT KEY

2010-09-10 Thread Stephen Frost
* Tom Lane (t...@sss.pgh.pa.us) wrote: > The reason it's sorting by all the columns is the DISTINCT You might also verify that you actually need/*should* have the DISTINCT, if it's included today.. Often developers put that in without understanding why they're getting dups (which can often be due

Re: [PERFORM] Slow SQL lookup due to every field being listed in SORT KEY

2010-09-10 Thread Tom Lane
Mason Harding writes: > Hi all. I Have the following query (tested in postgres 8.4 and 9.0rc1) > SELECT distinct event0_.* > FROM event event0_ inner join account account1_ on > event0_.account_id_owner=account1_.account_id > LEFT OUTER JOIN friend friendcoll2_ ON > account1_.account_id=friendco

Re: [PERFORM] Slow SQL lookup due to every field being listed in SORT KEY

2010-09-10 Thread Stephen Frost
* Mason Harding (mason.hard...@gmail.com) wrote: > Hi all. I Have the following query (tested in postgres 8.4 and 9.0rc1) Can you provide \d output from all the tables involved..? Also, what does the query plan look like w/o 'enable_seqscan=off' (which is not a good setting to use...)? Increasi

[PERFORM] Slow SQL lookup due to every field being listed in SORT KEY

2010-09-10 Thread Mason Harding
Hi all. I Have the following query (tested in postgres 8.4 and 9.0rc1) SELECT distinct event0_.* FROM event event0_ inner join account account1_ on event0_.account_id_owner=account1_.account_id LEFT OUTER JOIN friend friendcoll2_ ON account1_.account_id=friendcoll2_.friend_account_id WHERE (event