Re: generate_series from now to infinity...

From: "Dickson S(dot) Guedes" <listas(at)guedesoft(dot)net>
To: depesz(at)depesz(dot)com
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pg-dev <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: generate_series from now to infinity...
Date: 2009-05-17 17:50:55
Message-ID: 1242582655.18964.33.camel@guedes-laptop
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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=1 width=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)

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2009-05-17 17:53:22 Re: generate_series from now to infinity...
Previous Message hubert depesz lubaczewski 2009-05-17 17:22:02 Re: generate_series from now to infinity...