[PERFORM] Rapidly finding maximal rows

2011-10-13 Thread James Cranch
I have a slow query. I expect that there is either a more intelligent way to write it, or that one could make some indexes that would speed it up. I've tried various indexes, and am not getting anywhere. I'd be grateful for any suggestions. Reasonably full details are below. DESCRIPTION ===

Re: [PERFORM] Rapidly finding maximal rows

2011-10-12 Thread James Cranch
potentially resulting in your system running out of memory/OOM etc. Thanks, I'll bear that in mind as a strategy. It's good to know. But since Dave has saved me the sort altogether, I'll go with his plan. Best wishes, James \/\/\ -- ---

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

[PERFORM] Rapidly finding maximal rows

2011-10-11 Thread James Cranch
I have a slow query, based on the problem of finding the set of rows which are maximal in some sense. I expect that there is either a more intelligent way to write it, or that one could make some indexes that would speed it up. I've tried various indexes, and am not getting anywhere. I'd be