| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> c.d.o.server -> Tuning: PLSQL/INSERT INTO statement
I have a select query that I execute and it takes several minutes to get the
results back. Now I want to put those results into a table so I do: INSERT
INTO <TABLE>
SELECT Query.
Now the process takes hours to complete. The table has no constraints or
triggers. I did notice the temp table space keeps getting filled when I run
the query with the INSERT INTO clause but not when I run just the SELECT
statement. WHY?
The query looke something like this:
SELECT A1,
A2,
A3,
A4,
A5,
FROM ( SELECT A1
A2
A3
sum(A4)
FROM ( SELECT A1,
A2,
min(A3)
FROM table A, Table B
WHERE A1 = B1 and
A2 = B2
GROUP BY A1,A2) A , TABLE B
WHERE A1 = B1 and
A2 = B2
GROUP BY A1,A2,A3) AA
WHERE AA.A1 = VALUE
AA.A2 = VALUE
Any help would be appreciated. I just don't understand why it would take any more Temp table space do the insert on this query as it would to just execute the SELECT statement alone.
![]() |
![]() |