Skip to main content

Create Table vs Insert Into /*+direct*/

  • November 28, 2017
  • 1 reply
  • 4 views

kamil
Forum|alt.badge.img
  • Participating Frequently

Hi,

What is the difference between:

  • create table
  • insert into /+direct/

I did some tests and have difference (dramatic) between above 2 scenarios:

  • create table took abot 700s
  • insert into took about 10000s

I used the same sql statement.

?

1 reply

kamil
Forum|alt.badge.img
  • Author
  • Participating Frequently
  • November 28, 2017

I just checked...
Create table is creating projection with following order and segmentation:

ORDER BY test_col.col1,
test_col.col2,
test_col.col3,
test_col.col4
SEGMENTED BY hash(test_col.col1, test_col.col2, test_col.col4, test_col.col3)

I use col1 as my key in queries, so i thought that it will be the best to order by it (col1). But then it tooks a lot of time...

So its better to have more columns in order clause ?