Re: Hash index todo list item
От | Mark Mielke |
---|---|
Тема | Re: Hash index todo list item |
Дата | |
Msg-id | 46E16086.1010007@mark.mielke.cc обсуждение исходный текст |
Ответ на | Re: Hash index todo list item (Kenneth Marshall <ktm@rice.edu>) |
Ответы |
Re: Hash index todo list item
|
Список | pgsql-hackers |
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 -- Mark Mielke <mark@mielke.cc>
В списке pgsql-hackers по дате отправления: