Re: database not using indexes, yet

From: Silvio Brandani <silvio(dot)brandani(at)tech(dot)sdb(dot)it>
To: Szymon Guz <mabewlun(at)gmail(dot)com>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: database not using indexes, yet
Date: 2011-11-18 14:41:36
Message-ID: 4EC66EA0.9020900@tech.sdb.it
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

table is 959818 records,

I create a copy of the table with create tabase as select ... and
then indexed, the new table use the indexes ...

thanks

Il 18/11/2011 15.19, Szymon Guz ha scritto:
>
>
> 2011/11/18 Silvio Brandani <silvio(dot)brandani(at)tech(dot)sdb(dot)it
> <mailto:silvio(dot)brandani(at)tech(dot)sdb(dot)it>>
>
> On postgres 8.3.11 on linux centos 5 we have a table not too big
> with primary key index on
>
> Indexes:
> "aida_references_pkey" PRIMARY KEY, btree (aida_reference_id)
>
> the query not use index:
>
> aidadb=# explain analyze select aida_reference_id from
> aida.aida_references where aida_reference_id = '3145';
> QUERY PLAN
> ----------------------------------------------------------------------------------------------------------------
> Seq Scan on aida_references (cost=0.00..51489.15 rows=1 width=4)
> (actual time=0.173..1457.643 rows=1 loops=1)
> Filter: (aida_reference_id = 3145)
> Total runtime: 1457.696 ms
>
>
> already executed the vacuum ,reindex.
>
> Please help
>
> --
> Silvio Brandani
>
>
>
> Hi Silvio,
> how many rows do you have in the table?
> Usually PostgreSQL doesn't want to use index when the table is small.
>
>
> regards
> Szymon
>
>
> --
> *http://simononsoftware.com/*
>

--
Silvio Brandani
Infrastructure Administrator
SDB Information Technology
Phone: +39.055.3811222
Fax: +39.055.5201119

---

Utilizziamo i dati personali che la riguardano esclusivamente per nostre finalit amministrative e contabili, anche quando li comunichiamo a terzi. Informazioni dettagliate, anche in ordine al Suo diritto di accesso e agli altri Suoi diritti, sono riportate alla pagina http://www.savinodelbene.com/privacy.html
Se avete ricevuto questo messaggio per errore Vi preghiamo di ritornarlo al mittente eliminandolo assieme agli eventuali allegati, ai sensi art. 616 codice penale http://www.savinodelbene.com/privacy/codice_penale_616.html
L'Azienda non si assume alcuna responsabilit giuridica qualora pervengano da questo indirizzo messaggi estranei all'attivit lavorativa o contrari a norme.
--

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Tom Lane 2011-11-18 14:51:16 Re: database not using indexes, yet
Previous Message Szymon Guz 2011-11-18 14:19:01 Re: database not using indexes, yet