Re: GiST: PickSplit and multi-attr indexes

Поиск
Список
Период
Сортировка
От Greg Stark
Тема Re: GiST: PickSplit and multi-attr indexes
Дата
Msg-id 87r7mt7b1i.fsf@stark.xeocode.com
обсуждение исходный текст
Ответ на Re: GiST: PickSplit and multi-attr indexes  (Greg Stark <gsstark@mit.edu>)
Ответы Re: GiST: PickSplit and multi-attr indexes  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Greg Stark <gsstark@MIT.EDU> writes:

> I'm not sure that GiST indexes behave the same way as btree indexes for the
> multi-column case. 
> 
> In a btree index the second column is entirely subordinate to the first
> column. In a GiST index the data is multi-dimensional, and all dimensions are
> equally important.

In fact on further consideration I do have a proposal.

If you look at the GiST implementations for various index types you'll see
that many (all?) take the same approach for PickSplit. In fact they pretty
much all have the same code copy/pasted to handle it.

The approach they take is to have a function which calculates an abstract
"distance" between any two entries. There's an algorithm that they use to pick
the split based on this distance function.

If you abandoned "PickSplit" and instead exposed this distance function as the
external API then the behaviour for multi-column indexes is clear. You
calculate the distance along all the axes and calculate the diagonal distance.

I think abandoning PickSplit for the distance function might also mean you
don't need a separate function for Penalty either, but I'm not sure on that.

-- 
greg



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Bruno Wolff III
Дата:
Сообщение: Re: need help on writing an aggregate function
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Minor problem with Makefile.shlib