Changes in amcanreturn() interface to support multicolumn indexes

Lists: pgsql-hackers
From: Anastasia Lubennikova <lubennikovaav(at)gmail(dot)com>
To: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Changes in amcanreturn() interface to support multicolumn indexes
Date: 2014-06-26 08:37:08
Message-ID: CAP4vRV7XxvziKV6u7kZt6OoBAmmRX0Pun-h==zDDnzjJ269=yA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Changes in amcanreturn() interface to support multicolumn indexes.
Hi, hackers
I work on GSoC project Support_for_Index-only_scans_for_GIST_GSoC_2014
<https://wiki.postgresql.org/wiki/Support_for_Index-only_scans_for_GIST_GSoC_2014>
There is a question of support multicolumn index only scans for GIST.
I need help with this problem.

bool amcanreturn() - function to check whether index supports index-only
scans.
Now it's defined for
- B-tree. It always returns true, so there's no questions.
- SP-GIST. It doesn't support multicolumn indexes, so there's no problems
in spgcanreturn too.

- GIST. In first version it works only for onecolumn indexes.
gistcanreturn() checks whether fetch() method is defined for column's data
type.

There is a question of support multicolumn index only scans for GIST.
gistcanreturn() can return true if fetch is implemented for all indexed
columns and false otherwise.
But that's not very good case for multicolumn indexes.

I think, it requires extend the interface to add separate columns checking.
But I can't understand what kind of changes is required
and how would it affect on previous amcanreturn interface.

--
Regards,
Lubennikova Anastasia


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Anastasia Lubennikova <lubennikovaav(at)gmail(dot)com>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Changes in amcanreturn() interface to support multicolumn indexes
Date: 2014-06-26 17:55:24
Message-ID: 42401.1403805324@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Anastasia Lubennikova <lubennikovaav(at)gmail(dot)com> writes:
> There is a question of support multicolumn index only scans for GIST.
> gistcanreturn() can return true if fetch is implemented for all indexed
> columns and false otherwise.
> But that's not very good case for multicolumn indexes.

> I think, it requires extend the interface to add separate columns checking.
> But I can't understand what kind of changes is required
> and how would it affect on previous amcanreturn interface.

Yeah, rather than just returning a bool, I suppose we need it to return
an indication of which index columns it's prepared to return values for.
(And then I guess the runtime API should return nulls for index columns
it can't handle.) You could probably use either a bitmapset or an integer
List to return the column numbers.

I wouldn't be too worried about backwards compatibility in changing that
API. If there are any people supporting outside-core index AMs, they've
got much bigger problems than this.

regards, tom lane