Re: [PERFORM] Trying to eliminate union and sort

2013-07-11 Thread Josh Berkus
Brian, > 3. I'm trying to eliminate the union, however I have two problems. > A) I can't figure out how to have an 'or' clause in a single join that > would fetch all the correct rows. If I just do: > LEFT OUTER JOIN table2 t2 ON (t2.real_id = t.id OR t2.real_id = > t.backup_id), I end up with man

[PERFORM] Trying to eliminate union and sort

2013-07-11 Thread Brian Fehrle
Hi All, (basic info) PostgreSQL 9.2.4 64 bit Linux host 4GB shared_buffers with 14GB system memory, dedicated database VM 10MB work_mem I have a query that takes over 6 minutes to complete, and it's due mainly to the two sorting operations being done on this query. The data it is returning it