Re: Query does not use index - Mailing list pgsql-novice

From Martin Hampl
Subject Re: Query does not use index
Date
Msg-id A00A118A-9B58-11D8-91C4-000393674318@gmx.de
Whole thread Raw
In response to Re: Query does not use index  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Query does not use index
List pgsql-novice
Am 30.04.2004 um 17:52 schrieb Tom Lane:

> It could be that this table has a lot of empty pages near the front,
> which is a condition that's known to lead to underestimated row count
> from ANALYZE.  (Manfred is working on a better ANALYZE sampling method
> that should avoid such errors in future.)  Try doing a straight VACUUM
> and see if the row count estimate gets better.

It did! Thanks! Explain analyze now yields the following result:

Explain analyze now
                                                             QUERY PLAN
------------------------------------------------------------------------
----------------------------------------------------------
  Nested Loop  (cost=0.00..70650.10 rows=12 width=32) (actual
time=170.449..181.663 rows=3 loops=1)
    ->  Index Scan using word_idx on token  (cost=0.00..30403.79
rows=7621 width=16) (actual time=158.237..179.105 rows=5 loops=1)
          Index Cond: ((word)::text = 'FACTSHEET'::text)
    ->  Index Scan using s_begin_idx on s  (cost=0.00..5.27 rows=1
width=16) (actual time=0.429..0.434 rows=1 loops=5)
          Index Cond: ((s.text_id = "outer".text_id) AND (s."start" =
"outer"."position"))
  Total runtime: 182.207 ms


I never deleted anything from this database, but it might be that I
dropped some of the tables a couple of times when populating the
database. Also 'copy from' failed a couple of times. Can that have the
same effect?

Thanks again,
Martin


pgsql-novice by date:

Previous
From: Tom Lane
Date:
Subject: Re: postmaster does not shut down
Next
From: Stephan Hochhaus
Date:
Subject: Setting up pgsql for ODBC