Re: Adding of indexes, best practises

From: Sean Davis <sdavis2(at)mail(dot)nih(dot)gov>
To: Machiel Richards <machielr(at)rdc(dot)co(dot)za>
Cc: "pgsql-novice(at)postgresql(dot)org" <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Adding of indexes, best practises
Date: 2010-05-26 10:39:16
Message-ID: AANLkTin3Tw6akxgQ0H-zuaAqyDjfbq4rO5_d2K1QT4tg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On Wed, May 26, 2010 at 4:47 AM, Machiel Richards <machielr(at)rdc(dot)co(dot)za>wrote:

> Good day all
>
>
>
> Maybe someone could help me out from a resource point of
> view or even from an experience point of view.
>
>
>
> I have been a dba for only a short while now and the
> training I did was not as intensive as you would get in cases like Oracle
> for instance.
>
>
>
> I am currently involved in a project for one of the clients
> where they are busy consolidating and migrating some of their systems.
>
>
>
> One of the tasks I need to do is to look at some of the
> queries that are quite lengthy and running for long periods, and then
> determine whether there are any indexes that should be added, etc...
>
>
>
> I know I can use the explain option to see what the query
> time will be as well as some other info, however from experience point of
> view this does not mean much to me yet.
>
>
>
> Can someone direct me to some info or assist regarding the
> following:
>
>
>
> · What does the explain output mean and how to interpret the
> output to determine how queries can be optimised.
>
> · Is there a guideline in terms of when / where indexes should be
> added or will be beneficial? How do I determine of the query needs and index
> or not.
>
>
>

As a VERY rough rule of thumb, any column that appears in a where clause or
is used in a join should be indexed.

Sean

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message JORGE MALDONADO 2010-05-26 16:47:03 UNABLE TO CONNECT TO A DATABASE IN A WEB SERVER.
Previous Message Machiel Richards 2010-05-26 08:47:05 Adding of indexes, best practises