From: KÖPFERL Robert <robert.koepferl@sonorys.at>
Cc: pgsql-sql@postgresql.org
Subject: Re: Function to either return one or all records
Date: Thu, 21 Apr 2005 08:43:03 +0200
Message-ID: <ED4E30DD9C43D5118DFB00508BBBA76EB166C8@neptun.sonorys.at> (raw)
Hmmm, you're right.
Is there any way to do a
explain select * from id_val_tbl where false
while explain doesn't tell SEQ_SCAN?
I have to admit that I didn't performance tested this. I just saw explain
writing SEQ_SCAN.
|-----Original Message-----
|From: Tom Lane [mailto:tgl@sss.pgh.pa.us]
|Sent: Mittwoch, 20. April 2005 23:06
|To: Tambet Matiisen
|Cc: KÖPFERL Robert; pgsql-sql@postgresql.org
|Subject: Re: [SQL] Function to either return one or all records
|
|
|"Tambet Matiisen" <t.matiisen@aprote.ee> writes:
|> Standard technique is to rewrite OR queries to UNION
|queries. I believe PostgreSQL optimizer does not do that
|automatically. So you could try instead:
|
|> select * from id_bal_tbl where $1 is null
|> union all
|> select * from id_bal_tbl where id = $1;
|
|... but that won't do anything to solve the performance problem.
|Doesn't help for the second select to use an index, if the first
|one grovels over the whole table anyway ...
|
| regards, tom lane
|
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: robert.koepferl@sonorys.at
Subject: Re: Function to either return one or all records
In-Reply-To: <ED4E30DD9C43D5118DFB00508BBBA76EB166C8@neptun.sonorys.at>
References: <ED4E30DD9C43D5118DFB00508BBBA76EB166C8@neptun.sonorys.at>
* 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