How to inject knowledge into a Postgres database

Поиск
Список
Период
Сортировка
От han.holl@informationslogik.nl
Тема How to inject knowledge into a Postgres database
Дата
Msg-id 200510071521.54187.han.holl@informationslogik.nl
обсуждение исходный текст
Ответы Re: How to inject knowledge into a Postgres database  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: How to inject knowledge into a Postgres database  (Oleg Bartunov <oleg@sai.msu.su>)
Список pgsql-general
Hello,

We have a table of people with a date-of-birth and a surname, both indexed.
We have queries like this:
select report from table where dateofbirth = '1966-12-12' and surname like
'boer%'

The planner estimates that in a 1.5M record table 'boer%' will have one record
and 1966-12-12 about 40.
Unfortunately, names are not evenly distributed, and in some combinations it
will have to process many thousands of records. On some older and slower
systems, this hurts.

Is there a way to tell the planner to always prefer the dateofbirth index ?
Alternatively, to inform it about the wildly uneven distribution of surnames
(this must be even worse in China).

A third possibility would be to rewrite such a query as a nested query: is
there a rewrite query - hook (like apaches mod_rewrite) available ? Or is
there a somewhere a proxy-server that could do this ?

Cheers,

Han Holl

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

Предыдущее
От: Douglas McNaught
Дата:
Сообщение: Re: How to delete Large Object from Database?
Следующее
От: Tom Lane
Дата:
Сообщение: Re: SELECT FOR SHARE