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)

Attachment: signature.asc
Description: Esta é uma parte de mensagem assinada digitalmente

Reply via email to