[PERFORM] ORDER BY user defined function performance issues

2004-06-11 Thread Nick Trainor
I have an application which logs interactions on a regular basis. The interaction details (their types, etc) are held in one table (tblitem) and the 'hits' are held in tbltotal. I have written a function to get the total 'hits' during a period and need to collect together the information from

Re: [PERFORM] ORDER BY user defined function performance issues

2004-06-11 Thread Paul Thomas
On 11/06/2004 12:14 Nick Trainor wrote: [snip] However, when I seek to ORDER the results, then it takes 'forever': EXPLAIN ANALYSE SELECT t1.value1,t1.value2, getday_total('1','23',t1.id::integer,'31','59','2','2004','182','153','6','2004','0') FROM tblitem t1 WHERE t1.type_id=23::int2 and

Re: [PERFORM] ORDER BY user defined function performance issues

2004-06-11 Thread Tom Lane
Nick Trainor [EMAIL PROTECTED] writes: What am I missing here? The ORDER BY query has to evaluate the function at *every* row of the table before it can sort. The other query was only evaluating the function at twenty rows. regards, tom lane