Re: [GENERAL] index vs. seq scan choice?

2007-06-08 Thread Patrick TJ McPhee
In article <[EMAIL PROTECTED]>, Tom Lane <[EMAIL PROTECTED]> wrote: % "George Pavlov" <[EMAIL PROTECTED]> writes: % >> From: Joshua D. Drake [mailto:[EMAIL PROTECTED] % >> In those rare cases wouldn't it make more sense to just set % >> enable_seqscan to off; run query; set enable_seqscan to on; %

Re: [GENERAL] index vs. seq scan choice?

2007-06-07 Thread Joshua D. Drake
George Pavlov wrote: From: Tom Lane "George Pavlov" <[EMAIL PROTECTED]> writes: From: Joshua D. Drake [mailto:[EMAIL PROTECTED] In those rare cases wouldn't it make more sense to just set enable_seqscan to off; run query; set enable_seqscan to on; 1. these cases are not that rare (to me); It s

Re: [GENERAL] index vs. seq scan choice?

2007-06-07 Thread George Pavlov
> From: Tom Lane > "George Pavlov" <[EMAIL PROTECTED]> writes: > >> From: Joshua D. Drake [mailto:[EMAIL PROTECTED] > >> In those rare cases wouldn't it make more sense to just set > >> enable_seqscan to off; run query; set enable_seqscan to on; > > > 1. these cases are not that rare (to me); > >

Re: [GENERAL] index vs. seq scan choice?

2007-06-07 Thread Tom Lane
"George Pavlov" <[EMAIL PROTECTED]> writes: >> From: Joshua D. Drake [mailto:[EMAIL PROTECTED] >> In those rare cases wouldn't it make more sense to just set >> enable_seqscan to off; run query; set enable_seqscan to on; > 1. these cases are not that rare (to me); It strikes me that you probably

Re: [GENERAL] index vs. seq scan choice?

2007-06-07 Thread Joshua D. Drake
George Pavlov wrote: From: Joshua D. Drake [mailto:[EMAIL PROTECTED] In those rare cases wouldn't it make more sense to just set enable_seqscan to off; run query; set enable_seqscan to on; 1. these cases are not that rare (to me); I find that surprising. 2. setting enable_seqscan (in JDB

Re: [GENERAL] index vs. seq scan choice?

2007-06-07 Thread George Pavlov
> From: Joshua D. Drake [mailto:[EMAIL PROTECTED] > > In those rare cases wouldn't it make more sense to just set > enable_seqscan to off; run query; set enable_seqscan to on; 1. these cases are not that rare (to me); 2. setting enable_seqscan (in JDBC, say) from the application makes the whole

Re: [GENERAL] index vs. seq scan choice?

2007-06-07 Thread Joshua D. Drake
George Pavlov wrote: From: Tom Lane [mailto:[EMAIL PROTECTED] "George Pavlov" <[EMAIL PROTECTED]> writes: to 977ms! If I go the other way and SET STATISTICS 1 (or 0) I can bring down the list to one entry (setting to 0 seems equivalent and still keeps the one most common entry!?) and I will ge

Re: [GENERAL] index vs. seq scan choice?

2007-06-07 Thread George Pavlov
> From: Tom Lane [mailto:[EMAIL PROTECTED] > "George Pavlov" <[EMAIL PROTECTED]> writes: > > I am curious what could make the PA query to ignore the > index. What are > > the specific stats that are being used to make this decision? > > you don't have the column's statistics target set high enou

Re: [GENERAL] index vs. seq scan choice?

2007-05-25 Thread John D. Burger
Steve Atkins wrote: Would it be possible to look at a much larger number of samples during analyze, then look at the variation in those to generate a reasonable number of pg_statistic "samples" to represent our estimate of the actual distribution? More datapoints for tables where the planner

Re: [GENERAL] index vs. seq scan choice?

2007-05-25 Thread PFC
Would it be possible to look at a much larger number of samples during analyze, then look at the variation in those to generate a reasonable number of pg_statistic "samples" to represent our estimate of the actual distribution? More datapoints for tables where the planner might benefit from

Re: [GENERAL] index vs. seq scan choice?

2007-05-24 Thread Steve Atkins
On May 24, 2007, at 8:26 PM, Tom Lane wrote: "Joshua D. Drake" <[EMAIL PROTECTED]> writes: Tom Lane wrote: I'm not sure I want to vote for another 10x increase by default, though. Outside of longer analyze times, and slightly more space taken up by the statistics, what is the downside?

Re: [GENERAL] index vs. seq scan choice?

2007-05-24 Thread Tom Lane
"Joshua D. Drake" <[EMAIL PROTECTED]> writes: > Tom Lane wrote: >> I'm not sure I want to vote for another 10x increase by >> default, though. > Outside of longer analyze times, and slightly more space taken up by the > statistics, what is the downside? Longer plan times --- several of the selfu

Re: [GENERAL] index vs. seq scan choice?

2007-05-24 Thread Joshua D. Drake
Tom Lane wrote: Alvaro Herrera <[EMAIL PROTECTED]> writes: Tom Lane wrote: (The default statistics target is 10, which is widely considered too low --- you might find 100 more suitable.) Does this mean that we should look into raising the default a bit? Probably ... the question is to what

Re: [GENERAL] index vs. seq scan choice?

2007-05-24 Thread Tom Lane
Alvaro Herrera <[EMAIL PROTECTED]> writes: > Tom Lane wrote: >> (The default statistics target is 10, which is widely considered too >> low --- you might find 100 more suitable.) > Does this mean that we should look into raising the default a bit? Probably ... the question is to what. The defaul

Re: [GENERAL] index vs. seq scan choice?

2007-05-24 Thread Alvaro Herrera
Tom Lane wrote: > (The default statistics target is 10, which is widely considered too > low --- you might find 100 more suitable.) Does this mean that we should look into raising the default a bit? -- Alvaro Herrerahttp://www.CommandPrompt.com/ The PostgreSQL Co

Re: [GENERAL] index vs. seq scan choice?

2007-05-24 Thread Tom Lane
"George Pavlov" <[EMAIL PROTECTED]> writes: > I am curious what could make the PA query to ignore the index. What are > the specific stats that are being used to make this decision? The frequency of the specific value being searched for, and the overall order-correlation of the column. Since the

[GENERAL] index vs. seq scan choice?

2007-05-24 Thread George Pavlov
I am trying to figure out how the distribution of data affects index usage by the query because I am seeing some behavior that does not seem optimal to my uneducated eye. I am on PG 8.1.8. I have two tables foo and foo_detail, both have been vacuum analyzed recently. Both have a property_id colum