pg.ddx.io pgsql-admin@postgresql.org mailing list archive
help / color / mirror / Atom feeddatabase not using indexes, yet
6+ messages / 3 participants
[nested] [flat]
* database not using indexes, yet
@ 2011-11-18 14:09 Silvio Brandani <silvio.brandani@tech.sdb.it>
0 siblings, 2 replies; 6+ messages in thread
From: Silvio Brandani @ 2011-11-18 14:09 UTC (permalink / raw)
To: pgsql-admin
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
---
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.
--
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: database not using indexes, yet
@ 2011-11-18 14:19 Szymon Guz <mabewlun@gmail.com>
parent: Silvio Brandani <silvio.brandani@tech.sdb.it>
1 sibling, 1 reply; 6+ messages in thread
From: Szymon Guz @ 2011-11-18 14:19 UTC (permalink / raw)
To: Silvio Brandani <silvio.brandani@tech.sdb.it>; +Cc: pgsql-admin
2011/11/18 Silvio Brandani <silvio.brandani@tech.sdb.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/* <http://simononsoftware.com/;
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: database not using indexes, yet
@ 2011-11-18 14:41 Silvio Brandani <silvio.brandani@tech.sdb.it>
parent: Szymon Guz <mabewlun@gmail.com>
0 siblings, 0 replies; 6+ messages in thread
From: Silvio Brandani @ 2011-11-18 14:41 UTC (permalink / raw)
To: Szymon Guz <mabewlun@gmail.com>; +Cc: 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.brandani@tech.sdb.it
> <mailto:silvio.brandani@tech.sdb.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.
--
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: database not using indexes, yet
@ 2011-11-18 14:51 Tom Lane <tgl@sss.pgh.pa.us>
parent: Silvio Brandani <silvio.brandani@tech.sdb.it>
1 sibling, 1 reply; 6+ messages in thread
From: Tom Lane @ 2011-11-18 14:51 UTC (permalink / raw)
To: Silvio Brandani <silvio.brandani@tech.sdb.it>; +Cc: pgsql-admin
Silvio Brandani <silvio.brandani@tech.sdb.it> writes:
> 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
There's nothing here to suggest that this query shouldn't use an index,
so the problem is in something you didn't show us. Maybe you have
enable_indexscan turned off, or maybe that index isn't really on that
table, or something else.
regards, tom lane
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: database not using indexes, yet
@ 2011-11-18 15:03 Silvio Brandani <silvio.brandani@tech.sdb.it>
parent: Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 6+ messages in thread
From: Silvio Brandani @ 2011-11-18 15:03 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-admin
Il 18/11/2011 15.51, Tom Lane ha scritto:
> Silvio Brandani<silvio.brandani@tech.sdb.it> writes:
>> 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
> There's nothing here to suggest that this query shouldn't use an index,
> so the problem is in something you didn't show us. Maybe you have
> enable_indexscan turned off, or maybe that index isn't really on that
> table, or something else.
>
> regards, tom lane
>
this is not the case, to be sure I have recreated the index and still
not work. moreover the copy of the table with the same ttpe of index is
using it.
I have vacuum full the table and still not work, how can I rebuild this
table ? this is a production database..
thanks
--
Silvio Brandani
---
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.
--
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: database not using indexes, yet
@ 2011-11-18 15:20 Tom Lane <tgl@sss.pgh.pa.us>
parent: Silvio Brandani <silvio.brandani@tech.sdb.it>
0 siblings, 0 replies; 6+ messages in thread
From: Tom Lane @ 2011-11-18 15:20 UTC (permalink / raw)
To: Silvio Brandani <silvio.brandani@tech.sdb.it>; +Cc: pgsql-admin
Silvio Brandani <silvio.brandani@tech.sdb.it> writes:
> Il 18/11/2011 15.51, Tom Lane ha scritto:
>> There's nothing here to suggest that this query shouldn't use an index,
>> so the problem is in something you didn't show us. Maybe you have
>> enable_indexscan turned off, or maybe that index isn't really on that
>> table, or something else.
> this is not the case, to be sure I have recreated the index and still
> not work. moreover the copy of the table with the same ttpe of index is
> using it.
Well, the rest of us can't see what you're doing, but I think this is
highly likely to be user error. Have you got more than one table named
aida_references?
regards, tom lane
^ permalink raw reply [nested|flat] 6+ messages in thread
end of thread, other threads:[~2011-11-18 15:20 UTC | newest]
Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2011-11-18 14:09 database not using indexes, yet Silvio Brandani <silvio.brandani@tech.sdb.it>
2011-11-18 14:19 ` Szymon Guz <mabewlun@gmail.com>
2011-11-18 14:41 ` Silvio Brandani <silvio.brandani@tech.sdb.it>
2011-11-18 14:51 ` Tom Lane <tgl@sss.pgh.pa.us>
2011-11-18 15:03 ` Silvio Brandani <silvio.brandani@tech.sdb.it>
2011-11-18 15:20 ` Tom Lane <tgl@sss.pgh.pa.us>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox