Re:

From: Denis Gasparin <denis(at)edinet(dot)it>
To: Doug McNaught <doug(at)wireboard(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re:
Date: 2001-08-24 09:54:06
Message-ID: 5.1.0.14.0.20010824115039.00a75be0@10.1.1.2
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I have done VACUUM ANALYZE too but the statistics continue preferring
sequential scan...

Now i'll try to use a different approach:
- i'll create the empty table with a CREATE TABLE (and a primary key on col1)
- then i'll populate it using then INSERT..SELECT statement
- Last i'll check what the statistics say about the SELECT on the primary
key query.

When i've done, i'll tell you...

Denis

At 19.03 23/08/01, Doug McNaught wrote:
>Denis Gasparin <denis(at)edinet(dot)it> writes:
>
> > Hi to all!
> > I have created a table using the CREATE TABLE new_table
> > (col1,col2,col3) AS SELECT col1,col2,col3 FROM org_table.
> >
> > I create an index on this table using the statement:
> > CREATE UNIQUE INDEX table_idx ON new_table (col1).
> > Then i do a select as this:
> > SELECT * FROM new_table WHERE col1 = 'value'.
> >
> > The problem is that when i do an explain this is the query plan:
> >
> > Seq Scan on new_table (cost=0.00..1116.38 rows=500 width=44)>
> >
> > Can anyone explain me why it doesn't use the index I have created?
>
>How populated is the table? If it's small, or if you haven't done
>VACUUM ANALYZE, the statistics may end up preferring a sequential
>scan.
>
>-Doug
>--
>Free Dmitry Sklyarov!
>http://www.freesklyarov.org/
>
>We will return to our regularly scheduled signature shortly.

In response to

  • Re: at 2001-08-23 17:03:29 from Doug McNaught

Responses

  • Re: at 2001-08-24 10:20:37 from Denis Gasparin

Browse pgsql-general by date

  From Date Subject
Next Message Arkadiusz Malinowski 2001-08-24 10:04:06 PostgreSQL what language
Previous Message Glen Parker 2001-08-24 08:53:53 Re: SELECT FOR UPDATE