Re: [SQL] A Costly function + LIMIT

2002-12-13 Thread Tom Lane
Chris Gamache <[EMAIL PROTECTED]> writes: > It runs "widget" on 1 records. The damage would be negligible if it could > run on the 100... So do the function calculation outside the UNION/ORDER BY. SELECT name, address, city, state, zip, widget(name, address, city, state, zip) FROM ((SELECT *

[SQL] A Costly function + LIMIT

2002-12-13 Thread Chris Gamache
PostgreSQL 7.2.3 I have a function that is quite costly to run on 1000's of records... Let's call it "widget". I have a query (SELECT name, address, city, state, zip, widget(name, address, city, state, zip) FROM eastern_usa ORDER BY state, city, zip, name LIMIT 5000) UNION ALL (SELECT name