Re: [PERFORM] Replacing Cursors with Temporary Tables

2010-04-24 Thread Merlin Moncure
2010/4/24 Grzegorz Jaśkiewicz : > > > On Sat, Apr 24, 2010 at 2:23 PM, Merlin Moncure wrote: >> >> Well, you missed the most important part: not using cursors at all. >> Instead of declaring a cursor and looping it to build the array, build >> it with array().  That's what I've been saying: arrays

Re: [PERFORM] Replacing Cursors with Temporary Tables

2010-04-24 Thread Grzegorz Jaśkiewicz
On Sat, Apr 24, 2010 at 2:23 PM, Merlin Moncure wrote: > > Well, you missed the most important part: not using cursors at all. > Instead of declaring a cursor and looping it to build the array, build > it with array(). That's what I've been saying: arrays can completely > displace both temp tabl

Re: [PERFORM] Replacing Cursors with Temporary Tables

2010-04-24 Thread Merlin Moncure
On Fri, Apr 23, 2010 at 10:31 PM, Eliot Gable wrote: > In each case, the results are available outside the stored procedure by > either fetching from the cursor or selecting from the temporary table. > Clearly, the temporary table takes a performance hit compared using arrays. > Building an array

Re: [PERFORM] Replacing Cursors with Temporary Tables

2010-04-24 Thread Pierre C
FYI, I had a query like this : (complex search query ORDER BY foo LIMIT X) LEFT JOIN objects_categories oc LEFT JOIN categories c GROUP BY ... (more joins) ORDER BY foo LIMIT X Here, we do a search on "objects" (i'm not gonna give all the details, they're not interesting for the problem at ha