From: | "Gregory Williamson" <Gregory(dot)Williamson(at)digitalglobe(dot)com> |
---|---|
To: | "Marc Cuypers" <m(dot)cuypers(at)mgvd(dot)be>, <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Postgresql not using an index |
Date: | 2008-08-01 09:47:53 |
Message-ID: | 8B319E5A30FF4A48BE7EEAAF609DB233021F30F3@COMAIL01.digitalglobe.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Marc --
> Hi,
>
> I'm using postgres 7.4 and bacula 1.38 on debian.
>
> In the bacula database there is a table named 'file' which has about 2.5
> million rows.
> In this table there is a field 'jobid' which is indexed.
> The index is created with the following command:
> CREATE INDEX file_jobid_idx ON file USING btree (jobid);
>
> The query:
> SELECT * from file where jobid=2792
>
> does a full scan and to my opinion it doesn't use the index.
> I already did a VACUUM ANALYZE on the database.
>
> Somebody an idea?
>
> EXPLAIN tells the following:
> Seq Scan on file (cost=0.00..707683.30 rows=207562 width=110) (actual
> time=103215.145..161153.664 rows=1 loops=1)
> Filter: (jobid = 2792)
> Total runtime: 161154.734 ms
Perhaps jobid is not an int -- maybe a bigint ? In which case the types don't match and the index won't be used (newer versions might do ok but 7.4 won't IIRC).
Perhaps we could see the table description from \d in the psql tool ?
HTH,
Greg Williamson
Senior DBA
DigitalGlobe
Confidentiality Notice: This e-mail message, including any attachments, is for the sole use of the intended recipient(s) and may contain confidential and privileged information and must be protected in accordance with those provisions. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message.
(My corporate masters made me say this.)
From | Date | Subject | |
---|---|---|---|
Next Message | Marc Cuypers | 2008-08-01 10:09:53 | Re: Postgresql not using an index |
Previous Message | Pavel Stehule | 2008-08-01 09:44:24 | Re: Postgresql not using an index |