Re: Small fix for inv_getsize - Mailing list pgsql-patches

From Denis Perchine
Subject Re: Small fix for inv_getsize
Date
Msg-id 0011022302230F.31936@dyp.perchine.com
Whole thread Raw
In response to Re: Small fix for inv_getsize  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Small fix for inv_getsize
List pgsql-patches
> > Just realized that inv_getsize is a little bit wrong :-)). It just get
> > the first page, not last
> > Here is the patch which will fix the behavior.
>
> No it doesn't; it's a loop, and your patch will change nothing.  Your
> original version tried to stop after fetching one tuple, which was
> wrong because of visibility considerations.
>
> Now that I think about it, this code could do a two-key scan backwards
> and stop after finding the first (last) valid tuple, but that's more
> than a one-line change.

Actual logic is to find the maximum of pageno, for specified oid.
I do index scan on 2-keys index, specifying only one key as constraint...
If I do index scan forward I will get the smallest pageno first...
Otherwise I get the highest pageno... And this is what I want...
Or I get something wrong? Isn't this how order by on index is done?

--
Sincerely Yours,
Denis Perchine

----------------------------------
E-Mail: dyp@perchine.com
HomePage: http://www.perchine.com/dyp/
FidoNet: 2:5000/120.5
----------------------------------

pgsql-patches by date:

Previous
From: Tom Lane
Date:
Subject: Re: Small fix for inv_getsize
Next
From: Tom Lane
Date:
Subject: Re: Small fix for inv_getsize