Re: b-tree index search algorithms

Поиск
Список
Период
Сортировка
От Samuel Vogel
Тема Re: b-tree index search algorithms
Дата
Msg-id 50072F15.2020107@muel-vogel.de
обсуждение исходный текст
Ответ на Re: b-tree index search algorithms  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: b-tree index search algorithms  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Am 17.07.12 19:38, schrieb Tom Lane:
> btree knows nothing about the datatypes it's working on except that 
> they have comparison functions. Converting the values to some sort of 
> numeric scale that you can interpolate on seems logically dubious and 
> fraught with practical difficulties. Now, we do have some code in 
> selfuncs.c that tries to do that, for some data types, but it's only 
> for planner estimation purposes, and we don't rely very heavily on its 
> results even in that context. Depending on it to be right for search 
> purposes sounds pretty scary. 

'convert_string_to_scalar' and others look interesting in selfuncs.c, 
thanks for the pointer!

>> Okay, how are indexes on char/text columns handled then?
> The datum values will be pointers to strings.

I can simply dereference it and read all bytes until a null-byte appears 
(depending on the collation and that I know that it actually is a string)?

> The btree code is (or reasonably can be) aware that such values are 
> pass-by-reference, and how to get to the bits. But the comparison 
> semantics of two different values are not something it knows about 
> except by asking the comparison function. This can be quite a 
> nontrivial matter even for text, since we follow strcoll() comparison 
> rules. regards, tom lane 

How would the b-tree know exactly that a value is only a reference? And 
even in that case you say that it could get the bits, but make no use of 
it, since it does not know what they represent, right?

Regards,
Samuel


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

Предыдущее
От: Simon Riggs
Дата:
Сообщение: Re: Checkpointer split has broken things dramatically (was Re: DELETE vs TRUNCATE explanation)
Следующее
От: Peter Eisentraut
Дата:
Сообщение: CHECK NO INHERIT syntax