In some cases, it takes several very large tables to correlate the case, but the time to retrieve is a small amount of data.
You can first retrieve the large table data, then insert it into the temporary table, and then associate the processing.
For example:
A database of a department store.
It has the following 2 tables without partitions.
Sales table: Sales date, sales serial number, sales amount
Sales schedule: Sales serial number, sales items, sales quantity
When the above table contains data for several years later.
If you want to query yesterday's sales totals. Very simple
SELECT * FROM sales table WHERE Sales date = yesterday.
But when you want to inquire about yesterday's sale, the sale of some kind of goods time. Is
On (Sales table. Sales Serial Number =
WHERE
Sales table. Sales date = yesterday
and sales schedules. Sales Items = an item
In this case, the query time is very long due to the 2 large table associations.
Temporary tables can be passed.
First
SELECT * FROM sales table WHERE Sales date = yesterday
and then
INSERT into temp table 2
SELECT * FROM sales list WHERE sales serial number in (SELECT sales serial number from temporary table 1)
At last
......
On (temporary table 1. Sales Serial number =
This is 2 small table correlation processing, query up, faster.
Oracle Temp Table