Skip site navigation (1) Skip section navigation (2)

Stuck using Sequential Scan

From: "Jeremy M(dot) Guthrie" <jeremy(dot)guthrie(at)berbee(dot)com>
To: pgsql-performance(at)postgresql(dot)org
Subject: Stuck using Sequential Scan
Date: 2004-09-07 21:32:03
Message-ID: 200409071632.05374.jeremy.guthrie@berbee.com (view raw or flat)
Thread:
Lists: pgsql-performance
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I have a problem where I have the table format listed below.  I have the 
primary key tsyslog_id and the index built against it.  However, when I 
select a unique row, it will only ever do a seq scan even after I turn off 
all other types except indexscan.  I understand you cannot fully turn off seq 
scan.  

Syslog_TArchive size:  1,426,472,960 bytes
syslog_tarchive_pkey size:  132,833,280 bytes
archhost_idx size:  300,802,048 bytes
tarchdatetime_idx size:  159,293,440 bytes
tarchhostid_idx size:  362,323,968 bytes

I cannot run vacuum more than once a day because of its heavy IO penalty.  I 
run analyze once an hour.  However, if I run analyze then explain, I see no 
difference in the planners decisions.  What am I missing?


TSyslog=# \d syslog_tarchive;
                                        Table "public.syslog_tarchive"
   Column   |          Type          |                                
Modifiers
- ------------+------------------------+-------------------------------------------------------------------------
 tsyslog_id | bigint                 | not null default 
nextval('public.syslog_tarchive_tsyslog_id_seq'::text)
 facility   | integer                |
 severity   | integer                |
 date       | date                   |
 time       | time without time zone |
 host       | character varying(128) |
 message    | text                   |
Indexes:
    "syslog_tarchive_pkey" primary key, btree (tsyslog_id)
    "archhost_idx" btree (host)
    "tarchdatetime_idx" btree (date, "time")
    "tarchhostid_idx" btree (tsyslog_id, host)

TSyslog=# explain select * from tsyslog where tsyslog_id=431650835;
                               QUERY PLAN
- -------------------------------------------------------------------------
 Seq Scan on tsyslog  (cost=100000000.00..100000058.20 rows=2 width=187)
   Filter: (tsyslog_id = 431650835)
(2 rows)

- -- 

- --------------------------------------------------
Jeremy M. Guthrie        jeremy(dot)guthrie(at)berbee(dot)com
Senior Network Engineer        Phone: 608-298-1061
Berbee                           Fax: 608-288-3007
5520 Research Park Drive         NOC: 608-298-1102
Madison, WI 53711
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFBPijTqtjaBHGZBeURAndgAJ4rT2NpG9aGAdogoZaV+BvUfF6TjACfaexf
LrBzhDQK72u8dCUuPOSHB+Y=
=DSxi
-----END PGP SIGNATURE-----

Responses

pgsql-performance by date

Next:From: Marc CousinDate: 2004-09-08 13:49:49
Subject: Problem with large query
Previous:From: Ron St-PierreDate: 2004-09-07 18:42:13
Subject: Re: [PERFORM] Table UPDATE is too slow

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group