pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Naomi Walker <nwalker@eldocomp.com>
To: Thomas A. Lowery <tl-lists@stlowery.net>
To: pgsql-admin <pgsql-admin@postgresql.org>
Subject: Re: Performance Problem Index Ignored, but why
Date: Wed, 22 May 2002 10:28:08 -0700
Message-ID: <4.2.2.20020522102413.00b51428@ecint.ecinet.com> (raw)
In-Reply-To: <20020521220113.A17282@stllnx1.stlassoc.com>


I'm not sure how well this works in Postgres.  For Informix, we could trick 
the optimizer into using an index with something like:

Select colname from table where colname !=NULL.

Specifically mentioning the column in the query was the trick.  In esql/C, 
there were return parameters that then told you how many rows were found.


>CREATE INDEX st_v_state_idx ON state_tst USING btree (v_state);
>CREATE INDEX st_f_state_idx ON state_tst USING btree (f_state);
>
>Load the table using a copy from ...
>
>vacuum verbose analyze state_tst;
>
>Total rows: 14309241
>
>Queries using either f_state = or v_state =  explain (and appear to
>execute) using a sequential scan.  Resulting in 60 - 80 second query
>times.
>
>Can I force the use of an index?  Or do I have something wrong?  Any




>ideas?
>
>pg_test=# explain select  count(*) from state_tst where f_state = 'PA';
>NOTICE:  QUERY PLAN:
>
>Aggregate  (cost=277899.65..277899.65 rows=1 width=0)
>   ->  Seq Scan on state_tst  (cost=0.00..277550.51 rows=139654
>   width=0)
>
>EXPLAIN
>
>---------------------------(end of broadcast)---------------------------
>TIP 4: Don't 'kill -9' the postmaster




view thread (5+ messages)

Message-ID: <4.2.2.20020522102413.00b51428@ecint.ecinet.com>
Permalink:  ../4.2.2.20020522102413.00b51428@ecint.ecinet.com/
Also on:    postgresql.org/message-id/4.2.2.20020522102413.00b51428@ecint.ecinet.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: nwalker@eldocomp.com, tl-lists@stlowery.net
  Subject: Re: Performance Problem Index Ignored, but why
  In-Reply-To: <4.2.2.20020522102413.00b51428@ecint.ecinet.com>
  References: <20020521220113.A17282@stllnx1.stlassoc.com> <4.2.2.20020522102413.00b51428@ecint.ecinet.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox