Re: searching multiple tables

From: Richard Broersma Jr <rabroersma(at)yahoo(dot)com>
To: "Keith D(dot) Evans" <evans(at)umbc(dot)edu>, pgsql-novice(at)postgresql(dot)org
Subject: Re: searching multiple tables
Date: 2006-05-31 22:40:20
Message-ID: 20060531224020.83861.qmail@web31802.mail.mud.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

> I want to search many tables for certain data. The tables all have
> exactly the same columns. In searching the archives, I noticed that the
> exact table name seemed to be required for the select ... from ..
> command, but we are talking about 20,000 tables or more. Specifiying
> each table would be extremely inconvenient. And we may want to search
> all the tables. Some of the columns are time, latitude and longitude.
> We want to be able to search on time and/or lat and lon. Time will be
> unique, but the lats and lons may repeat. Based on these search
> criteria, we will pull out other data (columns) from the table(s).
>
> I have been reading the documentation manuals for postgresql 7.4 and
> browsing the archives, but have not found an answer to this question.
> Can anyone help me?

I am not sure if your tables partations were created using inheritance. But if they were, you
would only have to "select * from parenttable;" and it would pull all of the data from all of its
children. While this would work, I would expect that the query would run slow. Or at least as
fast as a series on UNION All to combine all table data.

Regards,

Richard

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message operationsengineer1 2006-05-31 23:32:43 SQL Count Magic Required....
Previous Message Terry Lee Tucker 2006-05-31 22:00:44 Re: searching multiple tables