From: Bruce Momjian <pgman@candle.pha.pa.us>
To: Stephan Szabo <sszabo@megazone.bigpanda.com>
Cc: Markus Bertheau <twanger@bluetwanger.de>
Cc: pgsql-sql@postgresql.org
Subject: Re: avoid select expens_expr(col) like unneccessary calculations
Date: Mon, 21 Jul 2003 11:23:36 -0400 (EDT)
Message-ID: <200307211523.h6LFNa112572@candle.pha.pa.us> (raw)
In-Reply-To: <20030707154329.J82767-100000@megazone23.bigpanda.com>
Stephan Szabo wrote:
> On 8 Jul 2003, Markus Bertheau wrote:
>
> > when you have
> > select expensive_expression(column), * from table offset 20 limit 40
> >
> > can you somehow save the cost for the first 20 calculations of
> > expensive_expression?
>
> Right now the only way I can think of that might work is to push the
> offset/limit into a subselect on table and then do the
> expensive_expression at the top level.
Well, you can do:
SELECT * FROM (SELECT * FROM pg_class) AS pg_class
so you could do:
SELECT func(relname), *
FROM (SELECT * FROM pg_class OFFSET 20 LIMIT 40) AS pg_class
--
Bruce Momjian | http://candle.pha.pa.us
pgman@candle.pha.pa.us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: pgman@candle.pha.pa.us, sszabo@megazone.bigpanda.com, twanger@bluetwanger.de
Subject: Re: avoid select expens_expr(col) like unneccessary calculations
In-Reply-To: <200307211523.h6LFNa112572@candle.pha.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox