A Costly function + LIMIT

From: Chris Gamache <cgg007(at)yahoo(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: A Costly function + LIMIT
Date: 2002-12-13 18:14:35
Message-ID: 20021213181435.31771.qmail@web13804.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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, address, city, state, zip, widget(name, address, city, state,
zip)
FROM western_usa
ORDER BY state, city, zip, name
LIMIT 5000)

ORDER BY 4, 3, 5, 1 LIMIT 100 OFFSET 0;

It runs "widget" on 10000 records. The damage would be negligible if it could
run on the 100...

Any ideas?

CG

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2002-12-13 18:20:49 Re: A Costly function + LIMIT
Previous Message Tom Lane 2002-12-13 18:12:05 Re: server terminated by a query in 7.3