Re: UUID index unused

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: UUID index unused
Дата
Msg-id 11699.1415567569@sss.pgh.pa.us
обсуждение исходный текст
Ответ на UUID index unused  (Kevin Wooten <kdubb@me.com>)
Ответы Re: UUID index unused  (Kevin Wooten <kdubb@me.com>)
Список pgsql-general
Kevin Wooten <kdubb@me.com> writes:
> I am assuming I am crazy and missing something completely obvious but I cannot get postgres (9.3.5) to use an index
ona UUID, ever.  

Worksforme:

regression=# create table foo (f1 uuid primary key);
CREATE TABLE
regression=# explain select * from foo where f1 = 'a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11';
                                QUERY PLAN
--------------------------------------------------------------------------
 Index Only Scan using foo_pkey on foo  (cost=0.15..8.17 rows=1 width=16)
   Index Cond: (f1 = 'a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11'::uuid)
(2 rows)

> The main table has a natural composite key (2 uuids and a timestamp) with which it always uses the timestamp as the
indexcondition and filters on the UUIDs. 

This probably has little to do with the datatype as such, and much to do
with the specifics of your query, the available indexes, and the table's
statistics.  It's hard to speculate further without lots more detail
about those things.

            regards, tom lane


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

Предыдущее
От: Adrian Klaver
Дата:
Сообщение: Re: UUID index unused
Следующее
От: Adrian Klaver
Дата:
Сообщение: Re: SSL Certificates in Postgres 9.3 and Windows 7