From: | Frank Wiles <frank(at)wiles(dot)org> |
---|---|
To: | "Michael Artz" <mlartz(at)gmail(dot)com> |
Cc: | pgsql-performance(at)postgresql(dot)org |
Subject: | Re: Subselect query enhancement |
Date: | 2007-02-01 18:20:45 |
Message-ID: | 20070201122045.79ff29c8.frank@wiles.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-performance |
On Thu, 1 Feb 2007 11:42:03 -0500
"Michael Artz" <mlartz(at)gmail(dot)com> wrote:
> I'm needing help determining the best all-around query for the
> following situation. I have primary table that holds ip information
> and two other tables that hold event data for the specific IP in with
> a one-to-many mapping between them, ie:
>
> CREATE TABLE ip_info (
> ip IP4,
> --other data
> );
>
> CREATE TABLE network_events (
> ip IP4 NOT NULL REFERENCES ip_info(ip),
> name VARCHAR,
> port INTEGER,
> --other data
> );
>
> CREATE TABLE host_events (
> ip IP4 NOT NULL REFERENCES ip_info(ip),
> name VARCHAR
> port INTEGER,
> --other data
> );
It would probably help to have an index on that column for all three
tables, then I would wager using joins will be the speed winner.
---------------------------------
Frank Wiles <frank(at)wiles(dot)org>
http://www.wiles.org
---------------------------------
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Artz | 2007-02-01 18:27:32 | Re: Subselect query enhancement |
Previous Message | Michael Artz | 2007-02-01 18:14:56 | Re: Subselect query enhancement |