Re: [HACKERS] Index of a table is not used (in any case) - Mailing list pgsql-sql

From Christopher Kings-Lynne
Subject Re: [HACKERS] Index of a table is not used (in any case)
Date
Msg-id ECEHIKNFIMMECLEBJFIGAEEOCCAA.chriskl@familyhealth.com.au
Whole thread Raw
In response to Index of a table is not used (in any case)  (Reiner Dassing <dassing@wettzell.ifag.de>)
List pgsql-sql
> Hello PostgreSQl Users!
>
> PostSQL V 7.1.1:

You should upgrade to 7.1.3 at some point...

> I have defined a table and the necessary indices.
> But the index is not used in every SELECT. (Therefore, the selects are
> *very* slow, due to seq scan on
> 20 million entries, which is a test setup up to now)
>
> The definitions can be seen in the annex.
>
> Does some body know the reason and how to circumvent the seq scan?

Yes. You probably have not run 'VACUUM ANALYZE' on your large table.

> Is the order of index creation relevant? I.e., should I create the
> indices before inserting
> entries or the other way around?

If you are inserting a great many entries, insert the data first and then
create the indices - it will be much faster this way.

> Should a hashing index be used? (I tried this, but I got the known error
> "Out of overflow pages")

Just do the default CREATE INDEX - btree should be fine... (probably)

> The table entry 'epoche' is used in two different indices. Should that
> be avoided?

It's not a problem, but just check your EXPLAIN output after the VACUUM to
check that you have them right.

Chris



pgsql-sql by date:

Previous
From: prinsarian@zonnet.nl (Arian Prins)
Date:
Subject: Re: Auto Increment
Next
From: "Stefan Lindner"
Date:
Subject: Re: system maintained keys