Efficiency of inner joins across multiple tables

From: Saptarshi Guha <saptarshi(dot)guha(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Efficiency of inner joins across multiple tables
Date: 2008-10-07 23:30:18
Message-ID: FAAC2F77-64EA-414E-B0EF-FD45AFE57BD3@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello,
I guess this is basic question for DBAs. I have several tables, each
numbering in 100,000's of rows.
They all have have connectionHash as the primary key and indices on
several variables.
E.g
Table1 has connectionHash, duration, type
Table2 has connectionHash, location
Table3 has connectionHash, region

Now i need to select columns:connectionHash, duration, location,
region (the variables can differ)
from Tables 1,2 and 3 using an inner join on connectionHash(indexed).

Q: How efficient is this?

Issues involved:
One might suggest that i make a table with all columns from across all
tables, however, as my research continues
more tables, TableK, with connectionHash, extracolumn will be created.
Option:
Every time i create a new table should i create a table with all
columns and query from that? So I make one new table
(made via an inner join, but done only once) and subsequent queries
made from this larger table(union of all columns from Tables 1..K)

Any suggestions will be very much welcome.
Regards
Saptarshi

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bill Reynolds 2008-10-08 00:02:19 Left outer join question
Previous Message Bessette-Halsema, Dominique E. 2008-10-07 22:18:27 pg_hba.conf use hostname not IP