Re: Sequences in transaction

Camm Maguire <camm@enhanced.com>

From: Camm Maguire <camm@enhanced.com>
To: Mike Castle <dalgoda@ix.netcom.com>
Cc: pgsql-general@postgresql.org
Date: 2000-12-11T16:14:42Z
Lists: pgsql-general
Greetings!  I've just found .. nothing!  This works pretty well to my
surprise.  Thanks so much for the suggestion.  I did a little rewrite
which builds a doubly-linked list table of dates, with prior date and
next date columns maintained by triggers.  I then retrieve adjacent
pairs of data table rows via a merge with this table.  This appears to
be faster than issuing a subselect  .... order by  ... limit 1 for
each data row, but your key idea (to me, at least) is that I can avoid
sequential sequence numbers by making explicit reference to the order
of the date values themselves. 

Thanks again!

Mike Castle <dalgoda@ix.netcom.com> writes:

> On Tue, Dec 05, 2000 at 12:03:40PM -0500, Camm Maguire wrote:
> > need to be able to *quickly* select a pair of *adjacent* rows in a
> > table.  t2.seq = t1.seq + 1 seems to work pretty well.  Of course, I
> 
> What's wrong with a select ... order by .. limit 2 ?
> 
> mrc
> -- 
>        Mike Castle       Life is like a clock:  You can work constantly
>   dalgoda@ix.netcom.com  and be right all the time, or not work at all
> www.netcom.com/~dalgoda/ and be right at least twice a day.  -- mrc
>     We are all of us living in the shadow of Manhattan.  -- Watchmen
> 
> 

-- 
Camm Maguire			     			camm@enhanced.com
==========================================================================
"The earth is but one country, and mankind its citizens."  --  Baha'u'llah