RE: Scan by TID (was RE: [HACKERS] How to add a new build-in operator)

From: "Hiroshi Inoue" <Inoue(at)tpf(dot)co(dot)jp>
To: "Bruce Momjian" <maillist(at)candle(dot)pha(dot)pa(dot)us>
Cc: "Thomas Lockhart" <lockhart(at)alumni(dot)caltech(dot)edu>, "pgsql-hackers" <pgsql-hackers(at)postgreSQL(dot)org>
Subject: RE: Scan by TID (was RE: [HACKERS] How to add a new build-in operator)
Date: 1999-10-11 10:12:06
Message-ID: 000201bf13d1$1260f560$2801007e@cadzone.tpf.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

>
> > > > I'm planning to implement a new type of scan,scan by TID.
> > > > It's on TODO * Allow WHERE restriction on ctid.
> > > > First,I want to define an equal operator between TID.
> > >

[snip]

>
> > I would use OIDs for '=' operator between TIDs as follows.
> > 387 for = (tid, tid)
> > 1292 for tideq(tid, tid)
> >
> >
> > Unfortunately,TIDs are changed by UPDATE operations.
> > So we would need some functions in order to get the latest
> > TID of a specified tuple such as
> > currtid(relationid/name, tid) which returns tid.
> > I would provide functions for both relid and relname and
> > use 1293-1294 for OIDs of these functions.
> >
> > Comments ?
> > If there's no objection,I would commit them to the current tree.
>
> Sounds good.
>

I have committed them to the current tree.
Needs initdb.

Now we could enjoy WHERE restriction on ctid as follows.
Unfortunately,the scan is still sequential.

=> create table t1 (dt text);
CREATE
=> insert into t1 values ('data inserted');
INSERT 45833 1
=> select ctid,* from t1;
ctid |dt
-----+----------
(0,1)|data inserted
(1 row)

=> select * from t1 where ctid='(0,1)';
dt
----------
data inserted
(1 row)

=> update t1 set dt='data updated';
UPDATE 1
=> select * from t1 where ctid='(0,1)';
dt
--
(0 rows)

=> select ctid,* from t1 where ctid=currtid2('t1', '(0,1)');
ctid |dt
-----+------------
(0,2)|data updated
(1 row)

Regards.

Hiroshi Inoue
Inoue(at)tpf(dot)co(dot)jp

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jan Wieck 1999-10-11 10:42:23 Re: [HACKERS] Interesting Quote you might enjoy about PGSQL.
Previous Message Oleg Bartunov 1999-10-11 09:32:47 vaccum problem