Query speed: replace into vs insert into ... select distinct
Posted: Sun Sep 01, 2002 4:30 am
Can anyone tell me which of the following would generally be faster? I do not know what my client has done to optimize mysql. Their mysql is running on a Sun E450 with 4 sparc 450 and 4 gigs of ram.
from_id is an int and to_id is the primary key in the table.
replace into [table] (to_id) select from_id from ....
This result set could have as many as 300,000 rows.
or
insert into [table] (to_id) select distinct from_id from ....
This result set could has as many as 100,000 rows.
from_id is an int and to_id is the primary key in the table.
replace into [table] (to_id) select from_id from ....
This result set could have as many as 300,000 rows.
or
insert into [table] (to_id) select distinct from_id from ....
This result set could has as many as 100,000 rows.