dbaspot
Tags Register FAQ Calendar Search Today's Posts Mark Forums Read

Insert-Select much slower than same select on its own - Oracle Server

This is a discussion on Insert-Select much slower than same select on its own - Oracle Server ; zzzzzz45@hotmail.com wrote: > Hi, > > I'm doing an insert into a table like so: > > Insert into table > (field1, field2...) > Select value1, value2... > from view > > The select on its own runs in under ...


Home > Database Forum > Oracle Database > Oracle Server > Insert-Select much slower than same select on its own

Reply

 

LinkBack Thread Tools Display Modes
  #1  
Old 08-31-2006, 09:53 AM
Database Bot
 
Join Date: Sep 2009
Posts: 1,236,254
Database Administrator is on a distinguished road
Default Re: Insert-Select much slower than same select on its own


zzzzzz45@hotmail.com wrote:
> Hi,
>
> I'm doing an insert into a table like so:
>
> Insert into table
> (field1, field2...)
> Select value1, value2...
> from view
>
> The select on its own runs in under a second. The insert select takes
> ~50 seconds. The explain plans differ greatly. The stats on the tables
> are up-to-date.
>
> I've tried the all_rows and append hints to no avail.
>
> Can somebody please advise why this drastic deterioration in
> performance may be happening?
>
> The db version is Oracle9i Enterprise Edition Release 9.2.0.6.0 -
> Production
>
> Thanks,
> Mark


how many rows do you select?
does it take under a second second to fetch all the rows?
and are there any indexes on the target table?

Reply With Quote
  #2  
Old 08-31-2006, 09:53 AM
Database Bot
 
Join Date: Sep 2009
Posts: 1,236,254
Database Administrator is on a distinguished road
Default Re: Insert-Select much slower than same select on its own


zzzzzz45@hotmail.com wrote:
> Hi,
>
> I'm doing an insert into a table like so:
>
> Insert into table
> (field1, field2...)
> Select value1, value2...
> from view
>
> The select on its own runs in under a second. The insert select takes
> ~50 seconds. The explain plans differ greatly. The stats on the tables
> are up-to-date.
>
> I've tried the all_rows and append hints to no avail.
>
> Can somebody please advise why this drastic deterioration in
> performance may be happening?
>
> The db version is Oracle9i Enterprise Edition Release 9.2.0.6.0 -
> Production
>
> Thanks,
> Mark


how many rows do you select?
does it take under a second second to fetch all the rows?
and are there any indexes on the target table?

Reply With Quote
  #3  
Old 08-31-2006, 09:57 AM
Database Bot
 
Join Date: Sep 2009
Posts: 1,236,254
Database Administrator is on a distinguished road
Default Re: Insert-Select much slower than same select on its own

> how many rows do you select?

V. small number always (under 20)

> does it take under a second second to fetch all the rows?


Yes - in toad I can do the select, copy the rows into excel, print it,
get the print out from my printer, ball it up and throw it at my
monitor faster than oracle can get the rows into the table

> and are there any indexes on the target table?

I tried it with an identical empty table with no indexes and it made no
difference to performance

Reply With Quote
  #4  
Old 08-31-2006, 09:57 AM
Database Bot
 
Join Date: Sep 2009
Posts: 1,236,254
Database Administrator is on a distinguished road
Default Re: Insert-Select much slower than same select on its own

> how many rows do you select?

V. small number always (under 20)

> does it take under a second second to fetch all the rows?


Yes - in toad I can do the select, copy the rows into excel, print it,
get the print out from my printer, ball it up and throw it at my
monitor faster than oracle can get the rows into the table

> and are there any indexes on the target table?

I tried it with an identical empty table with no indexes and it made no
difference to performance

Reply With Quote
  #5  
Old 08-31-2006, 10:03 AM
Database Bot
 
Join Date: Sep 2009
Posts: 1,236,254
Database Administrator is on a distinguished road
Default Re: Insert-Select much slower than same select on its own

zzzzzz45@hotmail.com wrote:
> Hi,
>
> I'm doing an insert into a table like so:
>
> Insert into table
> (field1, field2...)
> Select value1, value2...
> from view
>
> The select on its own runs in under a second. The insert select takes
> ~50 seconds. The explain plans differ greatly. The stats on the tables
> are up-to-date.
>
> I've tried the all_rows and append hints to no avail.
>
> Can somebody please advise why this drastic deterioration in
> performance may be happening?
>
> The db version is Oracle9i Enterprise Edition Release 9.2.0.6.0 -
> Production
>
> Thanks,
> Mark


It would have been helpful if you had posted the two explain plans.

It would be helpful to know what indexes exist on the table into
which the insert is taking place.

Potentially this could be a case where HINTS are required. But I
wouldn't want to jump that far yet. As Jonathan Lewis has said, and
I hope I am not misquoting, FULLY HINT if you want to force a
particular execution path.

But first lets see those explain plans generated with DBMS_XPLAN.
--
Daniel A. Morgan
University of Washington
damorgan@x.washington.edu
(replace x with u to respond)
Puget Sound Oracle Users Group
www.psoug.org
Reply With Quote
  #6  
Old 08-31-2006, 10:03 AM
Database Bot
 
Join Date: Sep 2009
Posts: 1,236,254
Database Administrator is on a distinguished road
Default Re: Insert-Select much slower than same select on its own

zzzzzz45@hotmail.com wrote:
> Hi,
>
> I'm doing an insert into a table like so:
>
> Insert into table
> (field1, field2...)
> Select value1, value2...
> from view
>
> The select on its own runs in under a second. The insert select takes
> ~50 seconds. The explain plans differ greatly. The stats on the tables
> are up-to-date.
>
> I've tried the all_rows and append hints to no avail.
>
> Can somebody please advise why this drastic deterioration in
> performance may be happening?
>
> The db version is Oracle9i Enterprise Edition Release 9.2.0.6.0 -
> Production
>
> Thanks,
> Mark


It would have been helpful if you had posted the two explain plans.

It would be helpful to know what indexes exist on the table into
which the insert is taking place.

Potentially this could be a case where HINTS are required. But I
wouldn't want to jump that far yet. As Jonathan Lewis has said, and
I hope I am not misquoting, FULLY HINT if you want to force a
particular execution path.

But first lets see those explain plans generated with DBMS_XPLAN.
--
Daniel A. Morgan
University of Washington
damorgan@x.washington.edu
(replace x with u to respond)
Puget Sound Oracle Users Group
www.psoug.org
Reply With Quote
  #7  
Old 08-31-2006, 10:04 AM
Database Bot
 
Join Date: Sep 2009
Posts: 1,236,254
Database Administrator is on a distinguished road
Default Insert-Select much slower than same select on its own

Hi,

I'm doing an insert into a table like so:

Insert into table
(field1, field2...)
Select value1, value2...
from view

The select on its own runs in under a second. The insert select takes
~50 seconds. The explain plans differ greatly. The stats on the tables
are up-to-date.

I've tried the all_rows and append hints to no avail.

Can somebody please advise why this drastic deterioration in
performance may be happening?

The db version is Oracle9i Enterprise Edition Release 9.2.0.6.0 -
Production

Thanks,
Mark

Reply With Quote
  #8  
Old 08-31-2006, 10:04 AM
Database Bot
 
Join Date: Sep 2009
Posts: 1,236,254
Database Administrator is on a distinguished road
Default Re: Insert-Select much slower than same select on its own


zzzzzz45@hotmail.com wrote:
> Hi,
>
> I'm doing an insert into a table like so:
>
> Insert into table
> (field1, field2...)
> Select value1, value2...
> from view
>
> The select on its own runs in under a second. The insert select takes
> ~50 seconds. The explain plans differ greatly. The stats on the tables
> are up-to-date.
>
> I've tried the all_rows and append hints to no avail.
>
> Can somebody please advise why this drastic deterioration in
> performance may be happening?
>
> The db version is Oracle9i Enterprise Edition Release 9.2.0.6.0 -
> Production
>
> Thanks,
> Mark


how many rows do you select?
does it take under a second second to fetch all the rows?
and are there any indexes on the target table?

Reply With Quote
  #9  
Old 08-31-2006, 10:04 AM
Database Bot
 
Join Date: Sep 2009
Posts: 1,236,254
Database Administrator is on a distinguished road
Default Re: Insert-Select much slower than same select on its own

> how many rows do you select?

V. small number always (under 20)

> does it take under a second second to fetch all the rows?


Yes - in toad I can do the select, copy the rows into excel, print it,
get the print out from my printer, ball it up and throw it at my
monitor faster than oracle can get the rows into the table

> and are there any indexes on the target table?

I tried it with an identical empty table with no indexes and it made no
difference to performance

Reply With Quote
  #10  
Old 08-31-2006, 10:04 AM
Database Bot
 
Join Date: Sep 2009
Posts: 1,236,254
Database Administrator is on a distinguished road
Default Re: Insert-Select much slower than same select on its own

zzzzzz45@hotmail.com wrote:
> Hi,
>
> I'm doing an insert into a table like so:
>
> Insert into table
> (field1, field2...)
> Select value1, value2...
> from view
>
> The select on its own runs in under a second. The insert select takes
> ~50 seconds. The explain plans differ greatly. The stats on the tables
> are up-to-date.
>
> I've tried the all_rows and append hints to no avail.
>
> Can somebody please advise why this drastic deterioration in
> performance may be happening?
>
> The db version is Oracle9i Enterprise Edition Release 9.2.0.6.0 -
> Production
>
> Thanks,
> Mark


It would have been helpful if you had posted the two explain plans.

It would be helpful to know what indexes exist on the table into
which the insert is taking place.

Potentially this could be a case where HINTS are required. But I
wouldn't want to jump that far yet. As Jonathan Lewis has said, and
I hope I am not misquoting, FULLY HINT if you want to force a
particular execution path.

But first lets see those explain plans generated with DBMS_XPLAN.
--
Daniel A. Morgan
University of Washington
damorgan@x.washington.edu
(replace x with u to respond)
Puget Sound Oracle Users Group
www.psoug.org
Reply With Quote
Reply

Thread Tools
Display Modes



All times are GMT -4. The time now is 08:42 AM.