Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id DB040477040 for ; Fri, 13 Dec 2002 13:14:44 -0500 (EST) Received: from web13804.mail.yahoo.com (web13804.mail.yahoo.com [216.136.175.14]) by postgresql.org (Postfix) with SMTP id 24A1747612D for ; Fri, 13 Dec 2002 13:14:36 -0500 (EST) Message-ID: <20021213181435.31771.qmail@web13804.mail.yahoo.com> Received: from [216.173.173.66] by web13804.mail.yahoo.com via HTTP; Fri, 13 Dec 2002 10:14:35 PST Date: Fri, 13 Dec 2002 10:14:35 -0800 (PST) From: Chris Gamache Reply-To: cgg007@yahoo.com Subject: A Costly function + LIMIT To: pgsql-sql@postgresql.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/181 X-Sequence-Number: 10769 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