views:

21

answers:

1

I am using large number of global temporary tables for generating huge reports against an Oracle 10g database. Each report consists of 4 to 5 global temporary tables(GTT) per say. But as far as I understand the concept of GTT's, the data is created on the fly per each session for different set of parameters.

For example, in my scenario, 20 users generates the report for, say last month of sales data and it can lead to upto 1000 executions on total per day. But if we assume that the user queries most recent sales data more frequently, than how can we use some cache memory to store for a range of sales data that is queried more frequently like a internet browser does??. Also any other suggestions for fine tuning the GTT's would be very helpful.

+1  A: 

It sounds like you are over-using GTTs. They are not normally needed very often in Oracle queries - in contrast to SQL Server where (I have read) it is more common and appropriate to use temporary tables. Without knowing your requirements in detail it is hard to recommend an approach, but materialized views are one way of "caching" query results once and using them many times.

Tony Andrews
+1. Most often I find a GTT used to drive a report will contain nothing but IDs (e.g. as selected by the user), which the report then joins back to the source data tables.
Jeffrey Kemp
Or to temporarily persist a data set that's expensive to build, but is referenced by multiple subreports.
Adam Musch