Re: [PROPOSAL] Covering + unique indexes.

Поиск
Список
Период
Сортировка
Искать
От
David Rowley
Тема
Re: [PROPOSAL] Covering + unique indexes.
Дата
Msg-id
CAKJS1f9xKx8av-q0D_Zw7Xc1kUE5BKA8O7W9DN9+11eqTeUuyg@mail.gmail.com
Ответ на
Список
Дерево обсуждения
[PROPOSAL] Covering + unique indexes. Anastasia Lubennikova <a.lubennikova@postgrespro.ru>
Re: [PROPOSAL] Covering + unique indexes. Jim Nasby <Jim.Nasby@BlueTreble.com>
Re: [PROPOSAL] Covering + unique indexes. Teodor Sigaev <teodor@sigaev.ru>
Re: [PROPOSAL] Covering + unique indexes. Thomas Munro <thomas.munro@enterprisedb.com>
Re: [PROPOSAL] Covering + unique indexes. Teodor Sigaev <teodor@sigaev.ru>
Re: [PROPOSAL] Covering + unique indexes. Jim Nasby <Jim.Nasby@BlueTreble.com>
Re: [PROPOSAL] Covering + unique indexes. Gavin Flower <GavinFlower@archidevsys.co.nz>
Re: [PROPOSAL] Covering + unique indexes. Teodor Sigaev <teodor@sigaev.ru>
Re: [PROPOSAL] Covering + unique indexes. David Rowley <david.rowley@2ndquadrant.com>
Re: [PROPOSAL] Covering + unique indexes. Vik Fearing <vik@2ndquadrant.fr>
Re: [PROPOSAL] Covering + unique indexes. Anastasia Lubennikova <a.lubennikova@postgrespro.ru>
Re: [PROPOSAL] Covering + unique indexes. Vik Fearing <vik@2ndquadrant.fr>
Re: [PROPOSAL] Covering + unique indexes. Nicolas Barbier <nicolas.barbier@gmail.com>
Re: [PROPOSAL] Covering + unique indexes. David Rowley <david.rowley@2ndquadrant.com>
Re: [PROPOSAL] Covering + unique indexes. Thom Brown <thom@linux.com>
Re: [PROPOSAL] Covering + unique indexes. Oleg Bartunov <obartunov@gmail.com>
Re: [PROPOSAL] Covering + unique indexes. Thom Brown <thom@linux.com>
Re: [PROPOSAL] Covering + unique indexes. Teodor Sigaev <teodor@sigaev.ru>
Re: [PROPOSAL] Covering + unique indexes. Anastasia Lubennikova <a.lubennikova@postgrespro.ru>
Re: [PROPOSAL] Covering + unique indexes. José Luis Tallón <jltallon@adv-solutions.net>
Re: [PROPOSAL] Covering + unique indexes. Thom Brown <thom@linux.com>
Re: [PROPOSAL] Covering + unique indexes. Rod Taylor <rod.taylor@gmail.com>
Re: [PROPOSAL] Covering + unique indexes. David Rowley <david.rowley@2ndquadrant.com>
Re: [PROPOSAL] Covering + unique indexes. Nicolas Barbier <nicolas.barbier@gmail.com>
Re: [PROPOSAL] Covering + unique indexes. Peter Geoghegan <pg@heroku.com>
Re: [PROPOSAL] Covering + unique indexes. Peter Geoghegan <pg@heroku.com>
Re: [PROPOSAL] Covering + unique indexes. Peter Geoghegan <pg@heroku.com>
Re: [PROPOSAL] Covering + unique indexes. Peter Geoghegan <pg@heroku.com>
Re: [PROPOSAL] Covering + unique indexes. David Rowley <david.rowley@2ndquadrant.com>
Re: [PROPOSAL] Covering + unique indexes. Anastasia Lubennikova <a.lubennikova@postgrespro.ru>
Re: [PROPOSAL] Covering + unique indexes. Teodor Sigaev <teodor@sigaev.ru>
Re: [PROPOSAL] Covering + unique indexes. David Rowley <david.rowley@2ndquadrant.com>
On 15 September 2015 at 23:51, Nicolas Barbier <nicolas.barbier@gmail.com> wrote:
2015-09-15 David Rowley <david.rowley@2ndquadrant.com>:

> I'm also a bit confused where f3 comes in here. If it's UNIQUE on (f1,f2)
> and we include f4. Where's f3?

Columns f1, f2, f3 are in the internal nodes of the tree (i.e., they
are used to find the ultimate leaf nodes). f4 is only in the leaf
nodes. If f4 are typically big values, and they are typically not used
in the search predicate, it makes the upper part of the index (which
determines how many levels the index has) larger for no good reason.
f4 can still be retrieved without going to the heap, so including it
in the leaf nodes makes it possible to do index-only scans more often.


Hmm, ok, I guess I was unable to see any advantage to having f3 in the btree, if it's not to be enforced as part of the unique constraint.
I now see that this is probably to allow pre-sorted paths without having to enforce uniqueness over all of the indexed columns.

If that's the case then I assume that we'd also want something to allow that to be done when creating a PRIMARY KEY constraint

Regards

David Rowley

--
 David Rowley                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services
 
В списке pgsql-hackers по дате отправления
От: Sameer Thakur-2
Дата:
От: Jim Nasby
Дата:
FAQ