Re: Query not using index

From: ryan(at)paymentalliance(dot)net
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Query not using index
Date: 2001-05-10 14:53:21
Message-ID: 3afaab30.281226902@news.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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 +0000 (UTC), mitch(at)venux(dot)net ("Mitch
Vincent") wrote:

>Does that query really return 9420 rows ? If so, a sequential scan is
>probably better/faster than an index scan..
>
>-Mitch
>
>----- Original Message -----
>From: <ryan(at)paymentalliance(dot)net>
>To: <pgsql-general(at)postgresql(dot)org>
>Sent: Thursday, May 10, 2001 9:22 AM
>Subject: Re: Query not using index
>
>
>> 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 +0000 (UTC),
>> sszabo(at)megazone23(dot)bigpanda(dot)com (Stephan Szabo) wrote:
>>
>> >
>> >Have you vacuum analyzed recently and what does
>> >explain show for the query?
>> >
>> >On Thu, 10 May 2001 ryan(at)paymentalliance(dot)net wrote:
>> >
>> >> Here's the query:
>> >>
>> >> SELECT
>> >> cart_row_id
>> >> FROM
>> >> pa_shopping_cart
>> >> WHERE
>> >> order_id = 20;
>> >> [ ... ]
>> >> There is an index on:
>> >> just order_id
>> >> just order_id and cart_row_id
>> >> and a PK on cart row_id
>> >>
>> >> I don't understand why it's not using one of these indexes!
>> >> Please post your responses to the group - my email is down.
>> >
>> >
>> >---------------------------(end of broadcast)---------------------------
>> >TIP 2: you can get off all lists at once with the unregister command
>> > (send "unregister YourEmailAddressHere" to majordomo(at)postgresql(dot)org)
>>
>>
>> ---------------------------(end of broadcast)---------------------------
>> TIP 5: Have you checked our extensive FAQ?
>>
>> http://www.postgresql.org/users-lounge/docs/faq.html
>>
>
>
>---------------------------(end of broadcast)---------------------------
>TIP 1: subscribe and unsubscribe commands go to majordomo(at)postgresql(dot)org

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2001-05-10 14:55:48 Re: GRANT
Previous Message Tom Lane 2001-05-10 14:53:01 Re: Re[2]: Vacuudb problem