Re: If it Exists... Update. If it DNE... insert.
Date: Fri, 20 Jul 2001 21:12:15 +1000
Message-ID: <11cblt4olv8oqk629g9nkm8chfellm2uvg_at_4ax.com>
On Mon, 16 Jul 2001 09:02:36 +0200, Ruud de Koter
<ruud_dekoter_at_hp.com> wrote:
> Hi Muirwa (?),
>
> muirwa wrote:
> >
> > I have a relatively simple question, that I can't find an explicit
> > answer to. So, I thought I would ask here.
> >
> > I am using JDBC with MySql and I have one flat and relatively simple
> > table. However, I will have to perform a large number of Inserts and
> > update. I am concerned with the load it can handle, and its
> > efficiency. My questions is, what is the 'best' way to go about the
> > following:
> >
> > 1. Given a Record, check to see if it exists in the table (SELECT).
> >
> > 1.1 If it exists, UPDATE record in the table.
> > 1.2 If it doesn't exist, INSERT record into table.
> >
> > However, given the simple steps above... For every one insert, there
> > are probably 100,000 updates. So, essentially there are 99,999 wasted
> > "SELECT" queries. But, as far as I can see it, it must be done in
> > order to determine whether to INSERT or UPDATE.
Received on Fri Jul 20 2001 - 13:12:15 CEST