Re: [PERFORM] Inefficient SELECT with OFFSET and LIMIT

2004-01-06 Thread Tom Lane
Greg Stark <[EMAIL PROTECTED]> writes: > Clive Page <[EMAIL PROTECTED]> writes: >> It would be nice if OFFSET could be implemented in some more efficient >> way. > You could do something like: > select myfunc(mycol) from (select mycol from table limit 50 offset 1) as x; Note that this won't

Re: [PERFORM] Inefficient SELECT with OFFSET and LIMIT

2004-01-06 Thread Greg Stark
Clive Page <[EMAIL PROTECTED]> writes: > SELECT myfunc(mycol) FROM table LIMIT 50 OFFSET 1 ; > It looks as if OFFSET is implemented just be throwing away the results, > until the OFFSET has been reached. > > It would be nice if OFFSET could be implemented in some more efficient > way. You

[PERFORM] Inefficient SELECT with OFFSET and LIMIT

2004-01-06 Thread Clive Page
I have just discovered that if one does a SELECT with a LIMIT and OFFSET values, say SELECT myfunc(mycol) FROM table LIMIT 50 OFFSET 1 ; Then the whole of the selection expressions, including the function calls, are actuall executed for every record, not just those being selected but als