Re: [PERFORM] "Hash index" vs. "b-tree index" (PostgreSQL

Список
Период
Сортировка
От Tom Lane
Тема Re: [PERFORM] "Hash index" vs. "b-tree index" (PostgreSQL
Дата
Msg-id 29017.1115777867@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: [PERFORM] "Hash index" vs. "b-tree index" (PostgreSQL  (Greg Stark)
Список pgsql-general
Дерево обсуждения
"Hash index" vs. "b-tree index" (PostgreSQL 8.0)  (Ying Lu, )
 Re: "Hash index" vs. "b-tree index" (PostgreSQL 8.0)  (Neil Conway, )
  Re: [PERFORM] "Hash index" vs. "b-tree index" (PostgreSQL 8.0)  (Christopher Petrilli, )
   Re: [PERFORM] "Hash index" vs. "b-tree index" (PostgreSQL  (Neil Conway, )
    Re: [PERFORM] "Hash index" vs. "b-tree index" (PostgreSQL  ("Jim C. Nasby", )
     Re: [PERFORM] "Hash index" vs. "b-tree index" (PostgreSQL  (Neil Conway, )
      Re: [PERFORM] "Hash index" vs. "b-tree index" (PostgreSQL  ("Jim C. Nasby", )
       Re: [PERFORM] "Hash index" vs. "b-tree index" (PostgreSQL  (Neil Conway, )
        Re: [PERFORM] "Hash index" vs. "b-tree index" (PostgreSQL  (Tom Lane, )
         Re: [PERFORM] "Hash index" vs. "b-tree index" (PostgreSQL  (Neil Conway, )
          Re: [PERFORM] "Hash index" vs. "b-tree index" (PostgreSQL  (Tom Lane, )
           Re: [PERFORM] "Hash index" vs. "b-tree index" (PostgreSQL  (Neil Conway, )
           Re: [PERFORM] "Hash index" vs. "b-tree index" (PostgreSQL  (Greg Stark, )
            Re: [PERFORM] "Hash index" vs. "b-tree index" (PostgreSQL  (Tom Lane, )
             Re: [PERFORM] "Hash index" vs. "b-tree index" (PostgreSQL  (Greg Stark, )
              Re: [PERFORM] "Hash index" vs. "b-tree index" (PostgreSQL  (Tom Lane, )
               Re: [PERFORM] "Hash index" vs. "b-tree index" (PostgreSQL  (Greg Stark, )
                Re: [PERFORM] "Hash index" vs. "b-tree index" (PostgreSQL  (Tom Lane, )
         Re: [PERFORM] "Hash index" vs. "b-tree index" (PostgreSQL  ("Jim C. Nasby", )
          Re: [PERFORM] "Hash index" vs. "b-tree index" (PostgreSQL  (Tom Lane, )
           Re: [PERFORM] "Hash index" vs. "b-tree index" (PostgreSQL  ("Jim C. Nasby", )
        Re: [PERFORM] "Hash index" vs. "b-tree index" (PostgreSQL  ("Jim C. Nasby", )
         Re: [PERFORM] "Hash index" vs. "b-tree index" (PostgreSQL  (Tom Lane, )
         Re: [PERFORM] "Hash index" vs. "b-tree index" (PostgreSQL  (Mischa Sandberg, )
          Re: [PERFORM] "Hash index" vs. "b-tree index" (PostgreSQL  (Mark Lewis, )
           Re: [PERFORM] "Hash index" vs. "b-tree index" (PostgreSQL  (Mischa Sandberg, )
            Re: [PERFORM] "Hash index" vs. "b-tree index" (PostgreSQL  (Bruce Momjian, )
             Re: [PERFORM] "Hash index" vs. "b-tree index" (PostgreSQL  (Mischa Sandberg, )
              Re: [PERFORM] "Hash index" vs. "b-tree index" (PostgreSQL  (Bruce Momjian, )
               Re: [PERFORM] "Hash index" vs. "b-tree index" (PostgreSQL  (Mischa Sandberg, )
             Re: [PERFORM] "Hash index" vs. "b-tree index" (PostgreSQL  (Neil Conway, )
              Re: [PERFORM] "Hash index" vs. "b-tree index" (PostgreSQL  (Bruce Momjian, )
          Re: [PERFORM] "Hash index" vs. "b-tree index" (PostgreSQL  (Tom Lane, )
           Re: [PERFORM] "Hash index" vs. "b-tree index" (PostgreSQL  (Mischa Sandberg, )
       Re: [PERFORM] "Hash index" vs. "b-tree index" (PostgreSQL  (Bruce Momjian, )
 Re: [PERFORM] "Hash index" vs. "b-tree index" (PostgreSQL  (Tom Lane, )
  Re: [PERFORM] "Hash index" vs. "b-tree index" (PostgreSQL  (Neil Conway, )
 Re: [PERFORM] "Hash index" vs. "b-tree index" (PostgreSQL  (Greg Stark, )
Greg Stark <> writes:
> Tom Lane <> writes:
>> No, not at all, because searching such an index will require a tree
>> descent, thus negating the one true advantage of hash indexes.

> The hash index still has to do a tree descent, it just has a larger branching
> factor than the btree index.

There is *no* tree descent in a hash index: you go directly to the
bucket you want.

If the bucket spans more than one page, you pay something, but this
strikes me as being equivalent to the case of multiple equal keys
spanning multiple pages in a btree.  It works, but it's not the design
center.

> btree indexes could have a special case hack to optionally use a large
> branching factor for the root node, effectively turning them into hash
> indexes.

No, because you'd still have to fetch and search the root node.

            regards, tom lane

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

Предыдущее
От: "Zlatko Matic"
Дата:
Сообщение: lazarus/zeos - installation ?
Следующее
От: Csaba Nagy
Дата:
Сообщение: Fixing a too long column value in a before insert trigger or rule