From: | Yasir Malik <ymalik(at)cs(dot)stevens(dot)edu> |
---|---|
To: | PostgreSQL <pgsql-sql(at)postgresql(dot)org> |
Subject: | Re: using pg_tables and tablename in queries |
Date: | 2005-10-04 19:23:15 |
Message-ID: | Pine.NEB.4.62.0510041518300.20189@long-trail.cs.stevens-tech.edu |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
> The current behavior is by design.
>
> We use the table as a logging repository. It can get very large 250 000
> records. Because of the large number of records that we have in the table we
> found it was much faster to perform inserts on a smaller table. Our current
> system rolls the tables over every 12 hours or so, creating a new table with
> the following behavior:
>
> CREATE TABLE mytable_temp {...}
>
> ALTER TABLE mytable RENAME TO mytable_back_datetime;
> ALTER TABLE mytable_temp RENAME TO mytable;
>
> I want to join the mytable_back_datetime tables together in order to perform
> queries against my huge set of data to generate some reports. I'm probably
> going to create a temporary table with a few indexes to make the reports run
> faster... however I need to join the tables all together first.
>
I would create a function that creates a string with a query that includes
all the tables you need, and call execute on the string. You would loop
through the all tables from pg_tables and keep on appending the table name
you need.
Regards,
Yasir
From | Date | Subject | |
---|---|---|---|
Next Message | Jim Buttafuoco | 2005-10-04 19:45:07 | Re: using pg_tables and tablename in queries |
Previous Message | solarsail | 2005-10-04 18:40:54 | Re: using pg_tables and tablename in queries |