Re: Index-only scans for GiST. - Mailing list pgsql-hackers

From Heikki Linnakangas
Subject Re: Index-only scans for GiST.
Date
Msg-id 54F3960B.8090305@iki.fi
Whole thread Raw
In response to Re: Index-only scans for GiST.  (Anastasia Lubennikova <lubennikovaav@gmail.com>)
Responses Re: Index-only scans for GiST.
List pgsql-hackers
On 02/27/2015 04:19 PM, Anastasia Lubennikova wrote:
> I add MemoryContext listCxt to avoid memory leak. listCxt is created once
> in gistrescan (only for index-only scan plan ) and reseted when scan of the
> leaf page is finished.
>
> I do not sure if the problem was completely solved, so I wait for feedback.

Yeah, I think that solves it.

> * What's the reason for turning GISTScanOpaqueData.pageData from an array
> to a List?
>
> This array is field of structure GISTScanOpaqueData. Memory for that
> structure allocated in function gistbeginscan(). The array is static so
> it's declared only one time in structure:
> GISTSearchHeapItem  pageData [BLCKSZ/sizeof(IndexTupleData)]
>
> But how could we know size of array if we don't know what data would be
> returned? I mean type and amount.

You're only adding a pointer to the IndexTuple to GISTSearchHeapItem.
The GISTSearchHeapItem struct itself is still of constant size.

I spent a little time cleaning this up. I reverted that pageData change
so that it's an array again, put back the gist_indexonly.sql and
expected output files that were missing from your latest version,
removed a couple of unused local variables that gcc complained about. I
refactored gistFetchTuple a bit, because it was doing IMHO quite bogus
things with NULLs. It was passing NULLs to the opclass' fetch function,
but it didn't pass the isNull flag correctly. I changed it so that the
fetch function is not called at all for NULLs.

I think this is pretty close to being committable. I'll make a round of
editorializing over the docs, and the code comments as well.

The opr_sanity regression test is failing, there's apparently something
wrong with the pg_proc entries of the *canreturn functions. I haven't
looked into that yet; could you fix that?

- Heikki


Attachment

pgsql-hackers by date:

Previous
From: Stephen Frost
Date:
Subject: Re: Bug in pg_dump
Next
From: Michael Paquier
Date:
Subject: Re: Bug in pg_dump