Re: About "Our CLUSTER implementation is pessimal" patch

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: About "Our CLUSTER implementation is pessimal" patch
Дата
Msg-id 12611.1264468951@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: About "Our CLUSTER implementation is pessimal" patch  (Leonardo F <m_lists@yahoo.it>)
Ответы Re: About "Our CLUSTER implementation is pessimal" patch  (Leonardo F <m_lists@yahoo.it>)
Список pgsql-hackers
Leonardo F <m_lists@yahoo.it> writes:
>> Rule it out.  Note you should be looking at pg_am.amcanorder, not
>> hardwiring knowledge of particular index types. 

> I can look at pg_am.amcanorder, but I would still need the ScanKey to be used
> by tuplesort; and I can't find any other way of doing it than calling 
> _bt_mkscankey_nodata, which is btree-specific.

Well, actually, it's not *quite* as btree specific as all that.  Note
the fine print in section 50.3:

: Some access methods return index entries in a well-defined order,
: others do not. If entries are returned in sorted order, the access
: method should set pg_am.amcanorder true to indicate that it supports
: ordered scans. All such access methods must use btree-compatible
: strategy numbers for their equality and ordering operators.

So in principle you could probably do something that avoided any
"official" dependency on btree.  Whether it's worth doing in practice is
pretty dubious though.  I agree that calling a routine that claims to be
btree-specific would be best done only after making a specific test for
BTREE_AM_OID.  If we ever get another index type that supports ordered
scans, it'll be time enough to worry about cases like this.

BTW, I think you could use tuplesort_begin_index_btree() rather than
touching _bt_mkscankey_nodata directly.  Doesn't affect the fundamental
problem, but you might as well use the most convenient API.
        regards, tom lane


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

Предыдущее
От: KaiGai Kohei
Дата:
Сообщение: Re: [BUG?] strange behavior in ALTER TABLE ... RENAME TO on inherited columns
Следующее
От: Tom Lane
Дата:
Сообщение: Re: default_language