Re: Unused indexes - PostgreSQL 9.2

From: Melvin Davidson <melvin6925(at)gmail(dot)com>
To: Lucas Possamai <drum(dot)lucas(at)gmail(dot)com>
Cc: Postgres General <pgsql-general(at)postgresql(dot)org>
Subject: Re: Unused indexes - PostgreSQL 9.2
Date: 2016-05-10 21:50:18
Message-ID: CANu8Fiy7d76vqyLe4z29Pg2iM=iwr+cPnimeO=4pkK_5Wm8A8A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

My bad, WHERE indexrelname = ' {YOUR INDEX NAME } ';

If you put the name of your index, you should get back stats for it. What
are those stats?

On Tue, May 10, 2016 at 5:47 PM, Lucas Possamai <drum(dot)lucas(at)gmail(dot)com>
wrote:

>
>> And what happens if you run this query?
>>
>> SELECT idstat.schemaname AS schema,
>> idstat.relname AS table_name,
>> indexrelname AS index_name,
>> idstat.idx_scan AS times_used,
>> pg_size_pretty(pg_relation_size(quote_ident(idstat.schemaname) ||
>> '.' || quote_ident(idstat.relname))) AS table_size,
>> pg_size_pretty(pg_relation_size(quote_ident(idstat.schemaname) ||
>> '.' || quote_ident(indexrelname))) AS index_size,
>> n_tup_upd + n_tup_ins + n_tup_del as num_writes,
>> indexdef AS definition
>> FROM pg_stat_user_indexes AS idstat
>> JOIN pg_indexes ON indexrelname = indexname
>> JOIN pg_stat_user_tables AS tabstat ON idstat.relname = tabstat.relname
>> WHERE indexrelname = ' {YOUR QUERY NAME } ';
>>
>>
> Sorry.. not sure what I should put into the WHERE clause ..
>
> But, taking off the WHERE it returns me 600 rows
>

--
*Melvin Davidson*
I reserve the right to fantasize. Whether or not you
wish to share my fantasy is entirely up to you.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Lucas Possamai 2016-05-10 21:54:55 Re: Unused indexes - PostgreSQL 9.2
Previous Message Lucas Possamai 2016-05-10 21:47:06 Re: Unused indexes - PostgreSQL 9.2