Re: Slow query and indexes...

From: Jim Nasby <decibel(at)decibel(dot)org>
To: PFC <lists(at)peufeu(dot)com>
Cc: "Jonas Henriksen" <jonas(dot)f(dot)henriksen(at)gmail(dot)com>, "Andrew Kroeger" <andrew(at)sprocks(dot)gotdns(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Slow query and indexes...
Date: 2007-05-08 15:35:33
Message-ID: 184EB9E2-3F5E-482E-BC15-EE246D6DF055@decibel.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On May 8, 2007, at 3:29 AM, PFC wrote:
> Create a table which contains your list of loggers (since it's good
> normalization anyway, you probably have it already) and have your
> data table's logger_id REFERENCE it

BTW, you could do that dynamically with a subselect: (SELECT DISTINCT
logger_id FROM data) AS loggers, though I'm not sure how optimal the
plan would be.

BTW, I encourage you to not use 'id' as a field name; I've found it
makes doing things like joins a lot trickier. Easier to just make
every id field the same (logger_id in this case).
--
Jim Nasby jim(at)nasby(dot)net
EnterpriseDB http://enterprisedb.com 512.569.9461 (cell)

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jim Nasby 2007-05-08 15:42:24 Re: Slow query and indexes...
Previous Message Andreas Schultz 2007-05-08 15:33:00 SELECT TIMESTAMP WITH TIME ZONE ... AT TIME ZOME as inverted meaning with UTC times...