On Thu, 2003-09-04 at 03:00, Alex wrote:
> Hi,
> MySQL has a nice feature that allows to call a replace rather insert
> which will attempt to insert if record not present and replace if it does.
>
> Is there any similar feature ?
>
> Currently I run a select prior to any insert and then update or insert
> depending on the result of the select. The problem here is that I just
> doubled the queries. Doing so on a table with 5Mio rows and on 100k
> inserts will take time and I would like to have an efficient way of
> doing it.
What if you try do the INSERT, and if it returns with a "key exists"
error, do the UPDATE?
Will the SELECT really slow things down that much, since the record
will be in buffers after you touch it the 1st time?
--
-----------------------------------------------------------------
Ron Johnson, Jr. ron.l.johnson@cox.net
Jefferson, LA USA
"All machines, no matter how complex, are considered to be based
on 6 simple elements: the lever, the pulley, the wheel and axle,
the screw, the wedge and the inclined plane."
Marilyn Vos Savant