Re: [GENERAL] How to inject knowledge into a Postgres database

2005-10-13 Thread han . holl
On Thursday 13 October 2005 16:06, Tom Lane wrote: > > You'd have to change the source code, but it's a simple tweak in the > ALTER SET STATISTICS code. > I don't think I'd want to do that. > > If the only penalty is slower analyzing, I don't care: we analyze at > > night when these system are idl

Re: [GENERAL] How to inject knowledge into a Postgres database

2005-10-13 Thread Tom Lane
[EMAIL PROTECTED] writes: > I've increased the statistics to 1000, and only occasionally, because of the > very uneven distribution of surnames, the planner does the wrong thing. > I've tried to set an even higher limit, but 1000 seems to be the maximum. > Is this hardcoded, or can I set a higher

Re: [GENERAL] How to inject knowledge into a Postgres database

2005-10-13 Thread han . holl
On Tuesday 11 October 2005 01:50, Jim C. Nasby wrote: > What's the datatype on naamvrouw? Notice that it's being casted to text, > which means an index on that column won't be used. > Datatype is text. My problem is that I want it to use the date of birth index. I've increased the statistics to 10

Re: [GENERAL] How to inject knowledge into a Postgres database

2005-10-10 Thread Jim C. Nasby
What's the datatype on naamvrouw? Notice that it's being casted to text, which means an index on that column won't be used. On Mon, Oct 10, 2005 at 11:29:38AM +0200, [EMAIL PROTECTED] wrote: > > Tom, Oleg, Yonathan, > > thanks for the suggestions. > Indeed, upping the statistics from 10 to 100 h

Re: [GENERAL] How to inject knowledge into a Postgres database

2005-10-10 Thread han . holl
Tom, Oleg, Yonathan, thanks for the suggestions. Indeed, upping the statistics from 10 to 100 helped. But order by did not: palga=# explain analyze select rapnaam from udps where geboortedatum = '1966-01-01' and naamvrouw like 'vos%' order by geboortedatum;

Re: [GENERAL] How to inject knowledge into a Postgres database

2005-10-09 Thread Yonatan Ben-Nes
Oleg Bartunov wrote: You could increase statistics or try contrib/tsearch2 Oleg On Fri, 7 Oct 2005, [EMAIL PROTECTED] wrote: 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-

Re: [GENERAL] How to inject knowledge into a Postgres database

2005-10-07 Thread Oleg Bartunov
You could increase statistics or try contrib/tsearch2 Oleg On Fri, 7 Oct 2005, [EMAIL PROTECTED] wrote: 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 l

Re: [GENERAL] How to inject knowledge into a Postgres database

2005-10-07 Thread Tom Lane
[EMAIL PROTECTED] writes: > 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). Increase the statistics target for that column, and re-ANALYZE the table.

[GENERAL] How to inject knowledge into a Postgres database

2005-10-07 Thread han . holl
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 4