pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Vik Fearing <vik.fearing@dalibo.com>
To: Scott Marlowe <scott.marlowe@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-performance@postgresql.org <pgsql-performance@postgresql.org>
Subject: Re: subselect requires offset 0 for good performance.
Date: Fri, 09 Aug 2013 00:09:17 +0200
Message-ID: <5204170D.4020608@dalibo.com> (raw)
In-Reply-To: <51FB61C8.4090206@dalibo.com>
References: <CAOR=d=2Fq-TzwzRf92BOeeHGqhkPXVG5_zs+_aR690ZxPp3JAg@mail.gmail.com>
	<4522.1375400642@sss.pgh.pa.us>
	<CAOR=d=3UVax7k_nT7Gm+Y2N0=0WZekT2dyOzxWM4wjsryfQL=Q@mail.gmail.com>
	<51FB61C8.4090206@dalibo.com>
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-performance>

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@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance



view thread (16+ messages)  latest in thread

Message-ID: <5204170D.4020608@dalibo.com>
Permalink:  ../5204170D.4020608@dalibo.com/
Also on:    postgresql.org/message-id/5204170D.4020608@dalibo.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: vik.fearing@dalibo.com, scott.marlowe@gmail.com, tgl@sss.pgh.pa.us
  Subject: Re: subselect requires offset 0 for good performance.
  In-Reply-To: <5204170D.4020608@dalibo.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox