Re: Function to either return one or all records

Поиск
Список
Период
Сортировка
От KÖPFERL Robert
Тема Re: Function to either return one or all records
Дата
Msg-id ED4E30DD9C43D5118DFB00508BBBA76EB166C8@neptun.sonorys.at
обсуждение исходный текст
Ответ на Function to either return one or all records  (KÖPFERL Robert <robert.koepferl@sonorys.at>)
Список pgsql-sql
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
|


В списке pgsql-sql по дате отправления:

Предыдущее
От: Michael Fuhr
Дата:
Сообщение: Re: checking pgsql functions
Следующее
От: "Tambet Matiisen"
Дата:
Сообщение: Re: Function to either return one or all records