Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 267
  • Last Modified:

How can I use Oracle Hints to speed up Inserts?

Dear Experts,

I have a PL/SQL procedure like below. I have implemented some session-wide Parameter Setting and Oracle Hints to speed up the operation. Do you think that I used the correct set of parameters and hints, or could you offer me better?

Notes:
1-TEMP_TABLE is a small table with approximately 100.000 rows compared to main table which has millions of rows.  2-TEMP_TABLE has no indexes while main table has a nonunique index with multiple fields including date field.
3-TEMP_TABLE is an ordinary table while the main table is partitioned daily.

BR  
----------------------------------------------------------------------------------------------------------------------------------------
DECLARE
.......
BEGIN
.......
EXECUTE IMMEDIATE 'ALTER SESSION SET db_file_multiblock_read_count=16';
INSERT /*+ APPEND PARALLEL NOLOGGING */ INTO MAIN_TABLE SELECT * FROM TEMP_TABLE;
COMMIT;
EXECUTE IMMEDIATE 'TRUNCATE TABLE TEMP_TABLE DROP STORAGE';
END;
0
GurcanK
Asked:
GurcanK
1 Solution
 
sdstuberCommented:
if the temp table will have data for a particular day, you could insert directly to the partition that corresponds to that day.  it's not a hint, but could help.

your hints should help.   if you're going to force parallel, you might want to force a particular degree of parallelism otherwise it might vary from run to run.
0
 
GurcanKAuthor Commented:
How shall I insert derectly to the current day's partition? (partition creation is automatic in daily basis)
0

Featured Post

Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now