agora inbox for pgsql-sql@postgresql.org  
help / color / mirror / Atom feed
From: hubert depesz lubaczewski <depesz@depesz.com>
To: Yambu <hyambu@gmail.com>
Cc: pgsql-sql@lists.postgresql.org
Subject: Re: Identify columns that need indexes
Date: Thu, 12 Nov 2020 12:14:08 +0100
Message-ID: <20201112111408.GB4026@depesz.com> (raw)
In-Reply-To: <CALhHtcCmDSYf6_+JYF1uqojj0nQbqwYNCm0u5++7jcWnyCFfwg@mail.gmail.com>
References: <CALhHtcCmDSYf6_+JYF1uqojj0nQbqwYNCm0u5++7jcWnyCFfwg@mail.gmail.com>

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





view thread (2+ messages)

Message-ID: <20201112111408.GB4026@depesz.com>
Permalink:  ../20201112111408.GB4026@depesz.com/
Also on:    postgresql.org/message-id/20201112111408.GB4026@depesz.com

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: depesz@depesz.com, hyambu@gmail.com, pgsql-sql@lists.postgresql.org
  Subject: Re: Identify columns that need indexes
  In-Reply-To: <20201112111408.GB4026@depesz.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox