|
|
| |
 |
|
Oracle Tips
by Burleson Consulting
|
The Data Warehouse Development Life Cycle
Aggregating Data For The Oracle Warehouse
Using SQL To Create Summary Tables
If we keep our summary tables in the same database as our data
warehouse, it becomes easy to create the summary tables. In the
following example, you can see how we can easily use Oracle SQL to
create our tables:
CREATE TABLE month_by_customer_name
AS
SELECT month, customer_name, sum(total_sales)
FROM fact
GROUP BY customer_name;
CREATE TABLE region_by_item
AS
SELECT region, item_number, sum(total_sales)
FROM fact
GROUP BY item_number;
Note: These summary calculations may invoke full-table scans against
your data warehouse and may also use a very large sort area,
requiring sorting to disk. Because of the intense nature of these
queries, you will want to ensure that these summary tables are
created during off hours. For more information about tuning the
creation of summary tables, see Chapter 12, Tuning Oracle SQL.
Now that you see how easy it is to create summary tables, note that
it would be very easy to parameterize the Oracle SQL to allow the
dimension names to be replaced by symbolic variables. For example:
CREATE TABLE &1_by_&2
AS
SELECT &1, &2, SUM(total_sales)
GROUP BY &2;
 |
Expert Remote DBA
BC is America's oldest and largest Remote DBA Oracle support
provider. Get real Remote DBA experts, call
BC Remote DBA today. |
 |
|
|
|
|