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

From Bruce Momjian
Subject Re: Scan by TID (was RE: [HACKERS] How to add a new build-in operator)
Date
Msg-id 199910120322.XAA18860@candle.pha.pa.us
Whole thread Raw
In response to RE: Scan by TID (was RE: [HACKERS] How to add a new build-in operator)  ("Hiroshi Inoue" <Inoue@tpf.co.jp>)
Responses Re: Scan by TID (was RE: [HACKERS] How to add a new build-in operator)  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
> > > Looks like a lot of work, and a lot of added code bulk that will
> > > have to be maintained.  I haven't figured out why you think it's
> > > worth it... tids are so transient that I don't see much need for
> > > finding tuples by them...
> > 
> > That's why I just suggested a more short-circuited option of snatching
> > tid oids from expressions, and doing a heap_fetch directly at that point
> > to avoid the index scan.  Seems it could be done in just one file.
> >
> 
> I have thought the way as Tom says and I have a prospect to do it.
> But it would take a lot of work.
> 
> Where to snatch and return to(or exit from) planner/executor 
> in your story ?

Basically, if I remember, in the executor, access to a table either
opens the table for sequential scan, does an index scan, or has the
value it needs already in a result of a previous join result.

If we put something in the executor so when a sequential/index scan is
requested on a table that has a restriction on tid, you could just do a
heap_fetch and return the single row, rather than putting the query
through the whole scan process for every row checking to see if it
matches the WHERE restriction.

Seems like a few lines in the executor could do the entire job of
fetching by tid by short-circuiting the sequential/index scan.

--  Bruce Momjian                        |  http://www.op.net/~candle maillist@candle.pha.pa.us            |  (610)
853-3000+  If your life is a hard drive,     |  830 Blythe Avenue +  Christ can be your backup.        |  Drexel Hill,
Pennsylvania19026
 


pgsql-hackers by date:

Previous
From: "Sergio A. Kessler"
Date:
Subject: Re: Scripts (was Re: [HACKERS] Re: [INTERFACES] Next release is 7.0(?))
Next
From: The Hermit Hacker
Date:
Subject: Re: [HACKERS] Re: [GENERAL] Update of bitmask type