Odd estimation issue with user-defined type

Поиск
Список
Период
Сортировка
От Florian Weimer
Тема Odd estimation issue with user-defined type
Дата
Msg-id 82zkvyncaw.fsf@mid.bfk.de
обсуждение исходный текст
Ответы Re: Odd estimation issue with user-defined type  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-performance
I've created a few user-defined types quite similar to uuid which we
use to store various hashes in the database.  (The types use binary
encoding internally, but only expose hexadecimal strings externally.)

The hashes are roughly equidistributed, so when I do a range query
which is essentially based on a hash prefix(*), I expect the result to
contain N * 2**(-k) results, where N is the table size and k the
number of bits in the range.  Actual query results show that this is
the case.  The odd thing is that the planner thinks that the range
query will return about one quarter of the table, independently of the
range specified.  Of course, the row estimates are quite far off as a
result, leading to suboptimal plans.

Any idea what could cause this?  Do I need to provide some estimator
function somewhere?

(*) I don't use LIKE, because its optimization is hard-coded to a few
    types, but explicit BETWEEN ... AND queries.
--
Florian Weimer                <fweimer@bfk.de>
BFK edv-consulting GmbH       http://www.bfk.de/
Kriegsstraße 100              tel: +49-721-96201-1
D-76133 Karlsruhe             fax: +49-721-96201-99

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Major performance problem after upgrade from 8.3 to 8.4
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Odd estimation issue with user-defined type