Re: PostgreSQL BugTool Submission
От | Tom Lane |
---|---|
Тема | Re: PostgreSQL BugTool Submission |
Дата | |
Msg-id | 20949.967089135@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | PostgreSQL BugTool Submission (pgsql-bugs@postgresql.org) |
Список | pgsql-bugs |
pgsql-bugs@postgresql.org writes: > When performing a query against a table that has a 64bit (int8) > primary key a sequential scan always takes place. Possibly a casting issue. Observe: regression=# create table foo1 (f1 int8 primary key); NOTICE: CREATE TABLE/PRIMARY KEY will create implicit index 'foo1_pkey' for table 'foo1' CREATE regression=# explain select * from foo1 where f1 = 42; NOTICE: QUERY PLAN: Seq Scan on foo1 (cost=0.00..22.50 rows=10 width=8) EXPLAIN regression=# explain select * from foo1 where f1 = 42::int8; NOTICE: QUERY PLAN: Index Scan using foo1_pkey on foo1 (cost=0.00..8.14 rows=10 width=8) EXPLAIN The planner is not currently very smart about figuring out whether a cross-data-type operator (int8-vs-int4-equal, here) can be munged into the single-data-type operator that's associated with an index. An explicit cast will prod it in the right direction. We do plan to fix this, but there's still some debate about how... regards, tom lane
В списке pgsql-bugs по дате отправления: