Re: Need help optimizing this query

Поиск
Список
Период
Сортировка
От Michael Glaesemann
Тема Re: Need help optimizing this query
Дата
Msg-id 9CDB3C3E-0C9F-4502-A3D3-A5DD486C4F7C@seespotcode.net
обсуждение исходный текст
Ответ на Re: Need help optimizing this query  (Michael Glaesemann <grzm@seespotcode.net>)
Список pgsql-general
On Jul 18, 2007, at 16:01 , Michael Glaesemann wrote:

> CREATE OR REPLACE FUNCTION one_when(BOOLEAN)
> RETURNS INTEGER
> LANGUAGE SQL as $_$SELECT value_when($1,1)$_$;

I forgot to add that you can cast booleans to integers, so one_when
(expr) is equivalent to expr::int:

# SELECT (true and false)::int, (true or false)::int;
int4 | int4
------+------
     0 |    1
(1 row)

Of course, this rewriting shouldn't affect the performance at all: it
should just make it easier for you to read, which does have some value.

Michael Glaesemann
grzm seespotcode net



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

Предыдущее
От: "Pat Maddox"
Дата:
Сообщение: Re: Need help optimizing this query
Следующее
От: Steve Crawford
Дата:
Сообщение: Will partial index creation use existing index?