Re: Mechanics of Select

Поиск
Список
Период
Сортировка
От Willem Buitendyk
Тема Re: Mechanics of Select
Дата
Msg-id 47AFA39B.4020903@pcfish.ca
обсуждение исходный текст
Ответ на Re: Mechanics of Select  (Greg Smith <gsmith@gregsmith.com>)
Ответы Re: Mechanics of Select
Список pgsql-general
As others have suggested my big problem with the function I wrote was
that I had made it Volatile instead of Immutable (it is no doubt
suffering from code bloat as well).  That made all the difference.
Curiously though - I tried it just with the date_trunc function and it
was just as slow as my old Volatile function.

select * from track where datetime >= '2007-04-01' and datetime <
date_trunc('month','2007-04-01'::timestamp)+interval '1 month'; was
about 55s
select * from track where datetime >= '2007-04-01' and datetime <
first_day_next_month('2007-04-01'); was about 36s

cheers

Greg Smith wrote:
> On Sun, 10 Feb 2008, Willem Buitendyk wrote:
>
>> I have the following function that returns the first day of the next
>> month from whatever date is inserted.
>
> See if you can do this with date_trunc instead to avoid calling a
> function, which avoids the whole thing.  The first day of next month is:
>
> select date_trunc('month',now())+interval '1 month';
>
> I'd be curious how the runtime using that compares with the plpgsql
> version you've done.
>
> --
> * Greg Smith gsmith@gregsmith.com http://www.gregsmith.com Baltimore, MD
>


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

Предыдущее
От: Alban Hertroys
Дата:
Сообщение: Re: Mechanics of Select
Следующее
От: "Pierre Thibaudeau"
Дата:
Сообщение: Re: 8.3: where's the replacement tsearch2 module?