From: Joe Conway <jconway2@home.com>
To: Subra Radhakrishnan <subra100@yahoo.com>
To: pgsql-sql@postgresql.org
Subject: Re: Inconsistent usage of Index
Date: Sat, 9 Jun 2001 09:23:25 -0700
Message-ID: <005701c0f100$82acca70$0205a8c0@jecw2k1> (raw)
References: <20010609151802.49099.qmail@web13806.mail.yahoo.com>
> Instance #2
> -----------
> explain select * from allied_medical_req_main where v_ttyp_code = 'XRAY';
> NOTICE: QUERY PLAN:
>
> Seq Scan on allied_medical_req_main (cost=0.00..79.49 rows=713 width=192)
>
> EXPLAIN
> As you can see from Instance #1 and #2 above, the usage of Index is not
consistent. Do you
> have any suggestions?
>
> Thanks,
>
> Subra
>
> P.S: I also did vacuum on the database. However, I am not clear as to what
actually it does.
Among other things, "vacuum analyze" calculates statistics for the table
columns, which are used by the optimizer to decide how to most efficiently
execute the query. See
http://www.postgresql.org/idocs/index.php?sql-vacuum.html for an
explanation.
See
http://www.postgresql.org/idocs/index.php?performance-tips.html#USING-EXPLAI
N for information on how to interpret the explain output. The output above
on instance 2 shows 713 rows expected output. If this is a significant
percent of the total number of rows in this table, then it *is* more
efficient to perform a table scan instead of using the index. What is the
total number or rows in this table?
If you still really want to force an index scan, try issuing "SET
ENABLE_SEQSCAN = OFF;". See
http://www.postgresql.org/idocs/index.php?runtime-config.html#RUNTIME-CONFIG
-OPTIMIZER for an explanation.
Hope this helps,
-- Joe
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 using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: jconway2@home.com, subra100@yahoo.com
Subject: Re: Inconsistent usage of Index
In-Reply-To: <005701c0f100$82acca70$0205a8c0@jecw2k1>
* 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