Re: Identify columns that need indexes

From: hubert depesz lubaczewski <depesz(at)depesz(dot)com>
To: Yambu <hyambu(at)gmail(dot)com>
Cc: pgsql-sql(at)lists(dot)postgresql(dot)org
Subject: Re: Identify columns that need indexes
Date: 2020-11-12 11:14:08
Message-ID: 20201112111408.GB4026@depesz.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Thu, Nov 12, 2020 at 09:50:03AM +0200, Yambu wrote:
> May I know if there is a query I can run to identify the columns that need
> indexes. I know I can get tables that are having high sequential scans
> ,what I need is to identify are the columns.

Not really, as this would be in AI territory.
There can be queries that will find, for example, fkeys that are not
indexed. Or some other subset of problems.
But general "query that will tell me where to put index" - no.

The usual solution is to analyze logs, find queries that use most time,
and optimize them.

depesz

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Sachin Kumar 2020-11-18 17:43:12 Querry correction required
Previous Message Yambu 2020-11-12 07:50:03 Identify columns that need indexes