Re: Index-only scans for GiST.

From: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
To: Anastasia Lubennikova <lubennikovaav(at)gmail(dot)com>, Fabrízio Mello <fabriziomello(at)gmail(dot)com>
Cc: Thom Brown <thom(at)linux(dot)com>, Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Index-only scans for GiST.
Date: 2015-03-01 22:43:23
Message-ID: 54F3960B.8090305@iki.fi
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 Content-Type Size
indexonlyscan_gist_2.3-heikki.patch application/x-patch 36.9 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2015-03-02 01:59:50 Re: Bug in pg_dump
Previous Message Stephen Frost 2015-03-01 21:27:22 Re: Bug in pg_dump