Problem with indexes

From: Przemyslaw Kowalczyk <przemyslaw(dot)kowalczyk(at)engine(dot)com(dot)pl>
To: pgsql-general(at)postgresql(dot)org
Subject: Problem with indexes
Date: 2001-12-11 11:40:40
Message-ID: E16DnCS-0001YW-00@oak.engine.com.pl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi.

I'm trying to manage apache access logs with Postgresql (7.1). I've parsed
last month access logs for one of our sites into database. There are about
900 000 records. Then I've created index:

stats=# create index log_date on log(date);
CREATE

Then I've tried to select something from the table browsing on date, it
took about 3 minutes to get the result. So I've tried explain:

stats=# explain SELECT ip FROM log WHERE date = 1000733984 ;
NOTICE: QUERY PLAN:

Seq Scan on log (cost=0.00..52859.15 rows=9008 width=12)

EXPLAIN
Why is there seq scan, even though I've created index?

Structure of the table
stats=# \d log
Table "log"
Attribute | Type | Modifier
------------+-------------------------+----------
ip | character varying(20) | not null
date | bigint | not null
date_human | character varying(50) |
request | character varying(1024) | not null
response | character varying(3) |
size | bigint | not null
ref_inner | character varying(256) |
ref_outer | character varying(1024) |
browser | character varying(256) |
iduser | character varying(50) |
type | character varying(1) |
Indices: log_browser,
log_date,
log_iduser,
log_ip,
log_ref_inner,
log_ref_outer,
log_request,
log_response,
log_type

Postgresql runs on linux 2.4.12.

Regards
Przem

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Holger Krug 2001-12-11 13:20:03 bug or my ignorance ?
Previous Message Raymond O'Donnell 2001-12-11 10:47:45 Can't pg_dump