[ADMIN] database not using indexes, yet

2011-11-18 Thread Silvio Brandani
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

Re: [ADMIN] database not using indexes, yet

2011-11-18 Thread Szymon Guz
2011/11/18 Silvio Brandani silvio.brand...@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

Re: [ADMIN] database not using indexes, yet

2011-11-18 Thread Silvio Brandani
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.brand...@tech.sdb.it mailto:silvio.brand...@tech.sdb.it

Re: [ADMIN] database not using indexes, yet

2011-11-18 Thread Tom Lane
Silvio Brandani silvio.brand...@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

Re: [ADMIN] database not using indexes, yet

2011-11-18 Thread Silvio Brandani
Il 18/11/2011 15.51, Tom Lane ha scritto: Silvio Brandanisilvio.brand...@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=#

Re: [ADMIN] database not using indexes, yet

2011-11-18 Thread Tom Lane
Silvio Brandani silvio.brand...@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

[ADMIN] database not using indexes

2011-11-09 Thread Silvio Brandani
Our database seems not using index anymore, please help with, is a production database. is there a script to check missing index on foreign key ?? thanks a lot --- Utilizziamo i dati personali che la riguardano esclusivamente per nostre finalità amministrative e contabili, anche quando

Re: [ADMIN] database not using indexes

2011-11-09 Thread Kevin Grittner
Silvio Brandani silvio.brand...@tech.sdb.it wrote: Our database seems not using index anymore, please help with, is a production database. is there a script to check missing index on foreign key ?? You haven't provided enough information to allow anyone to help.

Re: [ADMIN] database not using indexes

2011-11-09 Thread Ruslan A. Bondar
Why have you decided it isn't using indexes? If index exists - postgres will use it. To write a script for this I need at least database version. On Wed, 09 Nov 2011 16:22:20 +0100 Silvio Brandani silvio.brand...@tech.sdb.it wrote: Our database seems not using index anymore, please help with,

Re: [ADMIN] database not using indexes

2011-11-09 Thread Silvio Brandani
Ok, the problem was on a big table on query like this: select outmessage0_.out_msg_id as out1_0_ from edi.out_messages outmessage0_, edi.transaction_set_partners transactio1_ where outmessage0_.transaction_set_partner=transactio1_.trn_set_prtn_id and outmessage0_.status_id='TOSND' and

Re: [ADMIN] database not using indexes

2011-11-09 Thread Craig Ringer
On 09/11/11 23:58, Ruslan A. Bondar wrote: Why have you decided it isn't using indexes? If index exists - postgres will use it. Actually that's not necessarily the case. PostgreSQL will only use an index if (a) the index can be used for that kind of query and (b) using the index will be

Re: [ADMIN] database not using indexes

2011-11-09 Thread Craig Ringer
On 10/11/11 01:06, Silvio Brandani wrote: Ok, the problem was on a big table on query like this: select outmessage0_.out_msg_id as out1_0_ from edi.out_messages outmessage0_, edi.transaction_set_partners transactio1_ where