Re: [GENERAL] Re: Query not using index

2001-05-11 Thread Tom Lane
"Richard Huxton" <[EMAIL PROTECTED]> writes: >> ?? Knowing that your previous guess was wrong doesn't tell you what the >> right answer is, especially not for the somewhat-different question that >> the next query is likely to provide. > Surely if you used a seqscan on "where x=1" and only got 2

[GENERAL] Re: Query not using index

2001-05-10 Thread ryan
You and Stephan hit it right on the nose - our table has been maliciously propagated with thousands of faulty values - once gone index are in use and DB is SPEEDING along 8) Thanks for your help!!! -r On Thu, 10 May 2001 21:49:28 + (UTC), in comp.databases.postgresql.general you wrote: >

Re: [GENERAL] Re: Query not using index

2001-05-10 Thread Tom Lane
"Richard Huxton" <[EMAIL PROTECTED]> writes: > Why doesn't PG (or any other system afaik) just have a first guess, run the > query and then if the costs are horribly wrong cache the right result. ?? Knowing that your previous guess was wrong doesn't tell you what the right answer is, especially n

Re: [GENERAL] Re: Query not using index

2001-05-10 Thread Tom Lane
Chris Jones <[EMAIL PROTECTED]> writes: >> Ah. You must have a few values that are far more frequent (like tens of >> thousands of occurrences?) and these are throwing off the planner's >> statistics. > I had a similar situation, where I had a lot of rows with 0's in > them. Changing those to N

Re: [GENERAL] Re: Query not using index

2001-05-10 Thread Chris Jones
On Thu, May 10, 2001 at 05:22:07PM -0400, Tom Lane wrote: > [EMAIL PROTECTED] writes: > > No the query usually returns between 0 and 5 rows. Usually not zero - > > most often 1. > > Ah. You must have a few values that are far more frequent (like tens of > thousands of occurrences?) and these a

Re: [GENERAL] Re: Query not using index

2001-05-10 Thread Tom Lane
[EMAIL PROTECTED] writes: > No the query usually returns between 0 and 5 rows. Usually not zero - > most often 1. Ah. You must have a few values that are far more frequent (like tens of thousands of occurrences?) and these are throwing off the planner's statistics. 7.2 will probably do better

[GENERAL] Re: Query not using index

2001-05-10 Thread ryan
No the query usually returns between 0 and 5 rows. Usually not zero - most often 1. -r On Thu, 10 May 2001 19:47:32 + (UTC), [EMAIL PROTECTED] ("Mitch Vincent") wrote: >Does that query really return 9420 rows ? If so, a sequential scan is >probably better/faster than an index scan.. > >-Mi

Re: [GENERAL] Re: Query not using index

2001-05-10 Thread Patrick Welche
On Thu, May 10, 2001 at 01:22:56PM +, [EMAIL PROTECTED] wrote: > I vacuum every half hour! Here is the output from EXPLAIN: > > NOTICE: QUERY PLAN: > > Seq Scan on pa_shopping_cart (cost=0.00..7237.94 rows=9420 width=296) > > EXPLAIN > > Thanks! Then try set enable_seqscan to off; exp

[GENERAL] Re: Query not using index

2001-05-10 Thread Mitch Vincent
Does that query really return 9420 rows ? If so, a sequential scan is probably better/faster than an index scan.. -Mitch - Original Message - From: <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, May 10, 2001 9:22 AM Subject: Re: Query not using index > I vacuum every half

[GENERAL] Re: Query not using index

2001-05-10 Thread ryan
I vacuum every half hour! Here is the output from EXPLAIN: NOTICE: QUERY PLAN: Seq Scan on pa_shopping_cart (cost=0.00..7237.94 rows=9420 width=296) EXPLAIN Thanks! On Thu, 10 May 2001 18:19:16 + (UTC), [EMAIL PROTECTED] (Stephan Szabo) wrote: > >Have you vacuum analyzed recently and