On Thu, 1 Feb 2007 11:42:03 -0500
"Michael Artz" <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]>
   http://www.wiles.org
 ---------------------------------


---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

               http://www.postgresql.org/docs/faq

Reply via email to