From: Kevin Grittner <kgrittn@ymail.com>
To: Mark Davidson <mark@4each.co.uk>
To: pgsql-performance@postgresql.org <pgsql-performance@postgresql.org>
Subject: Re: INDEX Performance Issue
Date: Fri, 5 Apr 2013 09:37:26 -0700 (PDT)
Message-ID: <1365179846.6562.YahooMailNeo@web162903.mail.bf1.yahoo.com> (raw)
In-Reply-To: <CAPpwVW1rja3ZSsAt1myg-Ptue6d_HRuSXBwMOmuBe_t4HyPgRg@mail.gmail.com>
References: <CAPpwVW1rja3ZSsAt1myg-Ptue6d_HRuSXBwMOmuBe_t4HyPgRg@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-performance>
Mark Davidson <mark@4each.co.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
--
Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance
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-performance@postgresql.org
Cc: kgrittn@ymail.com, mark@4each.co.uk
Subject: Re: INDEX Performance Issue
In-Reply-To: <1365179846.6562.YahooMailNeo@web162903.mail.bf1.yahoo.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox