From: Bruno Wolff III <bruno@wolff.to>
To: Merlin Moncure <merlin.moncure@rcsonline.com>
Cc: John A Meinel <john@arbash-meinel.com>
Cc: Postgresql Performance <pgsql-performance@postgresql.org>
Cc: elein <elein@varlena.com>
Subject: Re: tricky query
Date: Tue, 28 Jun 2005 14:31:23 -0500
Message-ID: <20050628193123.GA12571@wolff.to> (raw)
In-Reply-To: <6EE64EF3AB31D5448D0007DD34EEB3415C2BFF@Herge.rcsinc.local>
References: <6EE64EF3AB31D5448D0007DD34EEB3415C2BFF@Herge.rcsinc.local>
On Tue, Jun 28, 2005 at 12:02:09 -0400,
Merlin Moncure <merlin.moncure@rcsonline.com> wrote:
>
> Confirmed. Hats off to you, the above some really wicked querying.
> IIRC I posted the same question several months ago with no response and
> had given up on it. I think your solution (smallest X1 not in X) is a
> good candidate for general bits, so I'm passing this to varlena for
> review :)
>
> SELECT t1.id+1 as id_new FROM id_test t1
> WHERE NOT EXISTS
> (SELECT t2.id FROM id_test t2 WHERE t2.id = t1.id+1)
> ORDER BY t1.id LIMIT 1;
You need to rework this to check to see if row '1' is missing. The
above returns the start of the first gap after the first row that
isn't missing.
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: bruno@wolff.to, merlin.moncure@rcsonline.com, john@arbash-meinel.com, elein@varlena.com
Subject: Re: tricky query
In-Reply-To: <20050628193123.GA12571@wolff.to>
* 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