Re: Subselect query enhancement - Mailing list pgsql-performance

From Frank Wiles
Subject Re: Subselect query enhancement
Date
Msg-id 20070201122045.79ff29c8.frank@wiles.org
Whole thread Raw
In response to Subselect query enhancement  ("Michael Artz" <mlartz@gmail.com>)
List pgsql-performance
On Thu, 1 Feb 2007 11:42:03 -0500
"Michael Artz" <mlartz@gmail.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@wiles.org>
   http://www.wiles.org
 ---------------------------------


pgsql-performance by date:

Previous
From: "Michael Artz"
Date:
Subject: Re: Subselect query enhancement
Next
From: "Michael Artz"
Date:
Subject: Re: Subselect query enhancement