again on index usage (7.1.3)

From: Daniel Kalchev <daniel(at)digsys(dot)bg>
To: pgsql-hackers(at)postgresql(dot)org
Subject: again on index usage (7.1.3)
Date: 2002-02-12 12:36:11
Message-ID: 200202121236.OAA28220@dcave.digsys.bg
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I had one more frustrating exprience with the 7.1.3 optimizer handling
index/scan selection.

Here is the schema

RADIUS=# \d attrib
Table "attrib"
Attribute | Type | Modifier
-----------+----------------+---------------------
user_name | character(32) | not null default ''
attr | character(32) | not null default ''
value | character(128) |
op | character(2) |
Index: uattr

RADIUS=# \d uattr
Index "uattr"
Attribute | Type
-----------+---------------
user_name | character(32)
attr | character(32)
op | character(2)
btree

(this is for use by gnu-radius).

RADIUS=# select count(*) from attrib;
count
--------
396117
(1 row)

RADIUS=# select count(distinct user_name) from attrib;
count
-------
62713
(1 row)

each username has more or less the same number of attributes.

SELECT * FROM attrib WHERE user_name = 'xyz';

always results in sequential scan.

As you can see, there is sufficient number of different user_name values - why
the sequential scan?

Needless to say that turning off sequential scans results is measurably faster
index scan.

Daniel

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Marc G. Fournier 2002-02-12 13:24:45 Re: Optimizer(?) off by factor of 3 ... ?
Previous Message Zeugswetter Andreas SB SD 2002-02-12 11:00:44 Re: RTLD_LAZY considered harmful (Re: pltlc and pltlcu