Re: subselect requires offset 0 for good performance.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 08/02/2013 09:37 AM, Vik Fearing wrote:
> EXPLAIN ANALYZE
> WITH RECURSIVE
> x (start_time) AS
> (
>     SELECT generate_series(1, 1000000)
> ),
> t (time, timeround) AS
> (
>     SELECT time, time - time % 900000 AS timeround
>     FROM (SELECT min(start_time) AS time FROM x) AS tmp
>     UNION ALL
>     SELECT time, time - time % 900000
>     FROM (SELECT (SELECT min(start_time) AS time
>                   FROM x
>                   WHERE start_time >= t.timeround + 900000)
>           FROM t
>           WHERE t.time IS NOT NULL OFFSET 0
>          ) tmp
> )
> SELECT count(*) FROM t WHERE time IS NOT NULL;
>
> If you remove the OFFSET 0, you'll see two more subplans (because "time"
> is referenced three times).

Is this not interesting to anyone?

Vik


-- 
Sent via pgsql-performance mailing list (pgsql-performance@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance




[Postgresql General]     [Postgresql PHP]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Yosemite]

  Powered by Linux