Re: Hash index todo list item

Поиск
Список
Период
Сортировка
От Kenneth Marshall
Тема Re: Hash index todo list item
Дата
Msg-id 20070907143913.GH19403@it.is.rice.edu
обсуждение исходный текст
Ответ на Re: Hash index todo list item  (Mark Mielke <mark@mark.mielke.cc>)
Список pgsql-hackers
On Fri, Sep 07, 2007 at 10:30:30AM -0400, Mark Mielke wrote:
> Kenneth Marshall wrote:
>> I understand that a hash value is a many-to-one mapping. That is the
>> point of the flag in the index. The flag means that there is only one
>> item in the heap corresponding to that hash value. In this case we
>> know that the value in the heap is the correct one and a possibly
>> very expensive string comparison can be skipped. Given that the hash
>> function is doing its job, almost every string comparison can be skipped.
>> How long would it take to compare 1-32K of data? How much CPU usage?
>> With this field in place, you only need to check tuple visibility
> The value comparison cannot be skipped. I do not think you understand the 
> many-to-one mapping in its entirety.
>
> Example:
>
>    Table has: a(1), b(2), c(3)
>    Index has: 1 => 1 (unique), 2 => 2 (unique), 3 => 3 (unique)
>
> Query:
>
>    select * from table where key = 'z';
>
> If 'z' hashes to '3' (completely possible), then the index record 3 points 
> to tuple 3, and it "exists". Only, it doesn't because 'a' <> 'z'. You MUST 
> check the value.
>
> Cheers,
> mark
>
Yes, you are completely correct. Thank you for the reminder.

Regards,
Ken


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

Предыдущее
От: Brian Hurt
Дата:
Сообщение: Re: Hash index todo list item
Следующее
От: apoc9009
Дата:
Сообщение: Re: [FEATURE REQUEST] Streaming Onlinebackup (Maybe OFFTOPIC)