Re: INDEX Performance Issue

From: Kevin Grittner <kgrittn(at)ymail(dot)com>
To: Mark Davidson <mark(at)4each(dot)co(dot)uk>, "pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org>
Subject: Re: INDEX Performance Issue
Date: 2013-04-05 16:37:26
Message-ID: 1365179846.6562.YahooMailNeo@web162903.mail.bf1.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Mark Davidson <mark(at)4each(dot)co(dot)uk> wrote:

>   CONSTRAINT data_area_pkey PRIMARY KEY (data_id , area_id ),

So the only index on this 250 million row table starts with the ID
of the point, but you are joining to it by the ID of the area.
That's requires a sequential scan of all 250 million rows.  Switch
the order of the columns in the primary key, add a unique index
with the columns switched, or add an index on just the area ID.

Perhaps you thought that the foreign key constraints would create
indexes?  (They don't.)

--
Kevin Grittner
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Dave Johansen 2013-04-05 16:54:06 Re: Picking out the most recent row using a time stamp column
Previous Message Mark Davidson 2013-04-05 15:51:37 INDEX Performance Issue