Insert-Select

Database
Enthusiast

Insert-Select

Hi,
I want to insert the records from an existing table to new tables.
I would like to know the time taken when I use Insert-Select stmt.But I could not estimate this using EXPLAIN.

Is there a way out to calculate the time while running the Query?

Q:Say for example I have the tables A,B and C.

Table A :500000 rows
Table B :200000 rows
Table C:No Data.

I would like to insert the records from A-->B and A-->C
Which operation is faster and Why?
Thanks,
3 REPLIES
Enthusiast

Re: Insert-Select

Hi all,

I have witnessed a strange behaviour today after running an insert-select. Even though the select statement returns aproximately 50K rows, none was inserted and SQL Assistant completed it without any errors. Anyone have any idea of how that could happen?

Thanks.
Enthusiast

Re: Insert-Select

If you are inserting into a set table all duplicates will be discarded.
I assume this is what might have happened.

Vinay
Enthusiast

Re: Insert-Select

You are correct! Thanks very much.
Shouldn't TD return an error message like "Insert failed due to dup row on set table"?