Re: [PERFORM] Rapidly finding maximal rows

2011-10-12 Thread James Cranch
Dear Bricklen, Try setting work_mem to something larger, like 40MB to do that sort step in memory, rather than spilling to disk. The usual caveats apply though, like if you have many users/queries performing sorts or aggregations, up to that amount of work_mem may be used at each step potentiall

Re: [PERFORM] Rapidly finding maximal rows

2011-10-12 Thread James Cranch
Dear Dave, CREATE VIEW best_in_school_method3 AS SELECT competition_name, academic_year_beginning, centre_number, entry_id, total_score, (true) AS best_in_school FROM challenge_entries ce1 WHERE total_score = (SELECT MAX(total_score) FROM challenge_entries ce2 WHERE ce1.competiti

Re: [PERFORM] Composite keys

2011-10-12 Thread Greg Smith
On 10/12/2011 12:39 AM, Carlo Stonebanks wrote: So with PG I will stick to the general SQL rule that IF I use compound keys then we have the most selective columns to the left... correct? There was a subtle point Dave made you should pay close attention to though. If there are multiple in