Re: Yet another indexing issue.

From: "David Siebert" <david(at)eclipsecat(dot)com>
To: "Stephan Szabo" <sszabo(at)megazone23(dot)bigpanda(dot)com>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: Yet another indexing issue.
Date: 2002-03-19 22:06:47
Message-ID: OJEIJALIHAIBMMBFLCOBOEOCEDAA.david@eclipsecat.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-sql

Here is the explain output

Sort (cost=293.24..293.24 rows=1 width=128)
-> Seq Scan on phonecalls (cost=0.00..293.23 rows=1 width=128)

Here is the Table
CREATE TABLE "phonecalls" (
"irecnum" int4 DEFAULT nextval('"phonecalls_irecnum_seq"'::text) NOT NULL,
"scaller" varchar(80),
"sphone" varchar(40),
"sphone2" varchar(40),
"squedby" varchar(40),
"sfor" varchar(40),
"dplaceddate" timestamp,
"dtakendate" timestamp,
"dresdate" timestamp,
"ipri" int4,
"istatus" int4,
"iresolution" int4,
"ireques" int4,
"snotes" varchar(3999),
"stakenby" varchar(40),
CONSTRAINT "phonecalls_irecnum_key" UNIQUE ("irecnum")
);

Where would one find set enable_seqscan=off; in the docs?

-----Original Message-----
From: pgsql-general-owner(at)postgresql(dot)org
[mailto:pgsql-general-owner(at)postgresql(dot)org]On Behalf Of Stephan Szabo
Sent: Tuesday, March 19, 2002 3:51 PM
To: David Siebert
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: [GENERAL] Yet another indexing issue.

On Tue, 19 Mar 2002, David Siebert wrote:

>
> I am having issues with an Index.
> Here is the query
>
> SELECT * FROM phonecalls WHERE istatus = 0 AND (sfor = 'pat' OR
> sfor='TECHIES') ORDER BY ipri DESC, dplaceddate;
> I have tried '0' and jut plain 0 as well as type casting it with ::int4 .
>
> Here is the index I think it should use.
>
> CREATE INDEX phonecallspoll ON phonecalls USING btree (sfor varchar_ops,
> istatus int4_ops);
> But it is still doing a scan?
>
> Any suggestions?
> yes I have used Vacumme with the anylise option.

What is the schema (probably not meaningful but always helps), what does
explain show for the query (specifically for the row counds), does using
set enable_seqscan=off change the explain output?

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Doug McNaught 2002-03-19 22:10:12 Re: [Q] Distributing a binary of postgres with my software and license
Previous Message James Leigh 2002-03-19 21:52:39 ERROR: heap_delete: (am)invalid tid

Browse pgsql-sql by date

  From Date Subject
Next Message Ross J. Reedstrom 2002-03-19 22:12:14 Re: How to create crude report with psql and/or plpgsql
Previous Message Roberto Mello 2002-03-19 21:35:21 Re: How to create crude report with psql and/or plpgsql