Re: generate_series from now to infinity...

Поиск
Список
Период
Сортировка
От Dickson S. Guedes
Тема Re: generate_series from now to infinity...
Дата
Msg-id 1242582655.18964.33.camel@guedes-laptop
обсуждение исходный текст
Ответ на Re: generate_series from now to infinity...  (hubert depesz lubaczewski <depesz@depesz.com>)
Список pgsql-hackers
Em Dom, 2009-05-17 às 19:22 +0200, hubert depesz lubaczewski escreveu:
> it doesn't for this query:
>
> SELECT i from generate_series(now(), CAST('infinity'::date AS
> timestamp), interval '1 hour') as x (i) limit 3;
>
> which (as far as i understand it) should be the same.
>
> why is it not limiting generate_series in the second example? is it
> intentional?

The EXPLAIN output differ between both.

postgres=# EXPLAIN SELECT generate_series(now(), CAST('infinity'::date
AS timestamp), interval '1 hour') limit 3;                  QUERY PLAN
------------------------------------------------Limit  (cost=0.00..0.02 rows=1 width=0)  ->  Result  (cost=0.00..0.02
rows=1width=0) 


postgres=# explain SELECT i from generate_series(now(),
CAST('infinity'::date AS timestamp), interval '1 hour') as x (i) limit
3;                                  QUERY PLAN
--------------------------------------------------------------------------------Limit  (cost=0.00..0.05 rows=3 width=8)
->  Function Scan on generate_series x  (cost=0.00..17.50 rows=1000 
width=8)


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

Предыдущее
От: hubert depesz lubaczewski
Дата:
Сообщение: Re: generate_series from now to infinity...
Следующее
От: Tom Lane
Дата:
Сообщение: Re: generate_series from now to infinity...