• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Subquery Execution Issue

 
Rithanya Laxmi
Ranch Hand
Posts: 185
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am invoking a below sub query :-

insert into customer(select * from customer_temp)

Which is basically merging 2 tables, whether this query will be faster as both the queries will be invoked at once compared to invoking these queries individually?

For the above query whether 2 execution plan will be created or only one plan will be created? Please clarify.

Thanks
 
Brian Tkatch
Bartender
Posts: 567
25
Linux Notepad Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rithanya Laxmi wrote:Hi,

I am invoking a below sub query :-

insert into customer(select * from customer_temp)

Which is basically merging 2 tables, whether this query will be faster as both the queries will be invoked at once compared to invoking these queries individually?

For the above query whether 2 execution plan will be created or only one plan will be created? Please clarify.

Thanks


Other than being syntactically incorrect, that is the best way to do it via SQL. (export/import can be faster in some databases in some cases.) You need to remove the parenthesis for it to work, as the parenthesis denote a column list.

Ideally, however, a column list would be provided. * should only be used in COUNT(), EXISTS(), and ad-hoc queries: INSERT INTO Customer(col1, col2, col3) SELECT col1, col2, col3 FROM Customer Temp;
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic