Re: Another seq scan instead of index question

From: Nicholas Piper <nick(at)nickpiper(dot)co(dot)uk>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Another seq scan instead of index question
Date: 2001-08-07 18:21:48
Message-ID: 20010807192148.M7365@piamox7.haus
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, 07 Aug 2001, Nicholas Piper wrote:

Replying to myself with some more information.

> On Tue, 07 Aug 2001, Tom Lane wrote:

> > select attname,attdispersion,s.*
> > from pg_statistic s, pg_attribute a, pg_class c
> > where starelid = c.oid and attrelid = c.oid and staattnum = attnum
> > and relname = 'cdsongs';

> That doesn't look good to me as it contains dodgy bytes...

I've removed (hopefully) the nasty entries in my tables by deleting
where string is > 'zzzzzz'.

The new table which Tom said would be useful is ;

attname | attdispersion | starelid | staattnum | staop | stanullfrac | stacommonfrac | stacommonval | staloval | stahival
---------+---------------+----------+-----------+-------+-------------+---------------+---------------+----------+---------------------------
songid | -1 | 61094022 | 1 | 97 | 0 | 2.38796e-07 | 1 | 1 | 4210874
cdid | 4.68083e-06 | 61094022 | 2 | 97 | 0 | 2.3402e-05 | 677 | 1 | 364477
track | 0.0231398 | 61094022 | 3 | 97 | 0 | 0.0860681 | 0 | 0 | 97
song | 0.000651592 | 61094022 | 4 | 1066 | 0 | 0.00321658 | | | zzo, Moderato con Allegro
extt | 0.890565 | 61094022 | 5 | 664 | 0.937465 | 2.98494e-05 | The Residents | | zur Ruh gebracht

Unfortunately I'm still getting the same results:

depos=# explain select * from cdsongs where lower(song) like 'mushroom festival in hell';
NOTICE: QUERY PLAN:

Seq Scan on cdsongs (cost=0.00..103835.24 rows=41877 width=40)

EXPLAIN
depos=# set enable_seqscan = off;
SET VARIABLE
depos=# explain select * from cdsongs where lower(song) like 'mushroom festival in hell';
NOTICE: QUERY PLAN:

Index Scan using idx_cdsongs_song on cdsongs (cost=0.00..114921.91 rows=41877 width=40)

EXPLAIN

--
Part 3 MEng Cybernetics; Reading, UK http://www.nickpiper.co.uk/
Change PGP actions of mailer or fetch key see website 1024D/3ED8B27F
Choose life. Be Vegan :-) Please reduce needless cruelty + suffering !

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2001-08-07 18:25:21 Re: Another seq scan instead of index question
Previous Message Nicolas Kowalski 2001-08-07 18:18:29 Re: Admin tool