| From: | Vadim Mikheev <vadim(at)krs(dot)ru> |
|---|---|
| To: | Oleg Bartunov <oleg(at)sai(dot)msu(dot)su> |
| Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgreSQL(dot)org, pgsql-sql(at)postgreSQL(dot)org |
| Subject: | Re: [SQL] inserts/updates problem under stressing ! |
| Date: | 1999-07-26 06:26:06 |
| Message-ID: | 379BFF7E.BD57269E@krs.ru |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers pgsql-sql |
Oleg Bartunov wrote:
>
> >
> > SELECT FOR UPDATE will not help: if there was no record for
> > particular key then nothing will be locked and two records with
> > the same key will be inserted.
> >
> > Oleg, use LOCK IN SHARE ROW EXCLUSIVE MODE.
>
> Thanks Vadim. Just tried this, but still I see a difference between
> count hits (accumulated) from db and access_log. In my test these numbers are:
> 95 and 109. So I lost 14 hits ! And no errors !
> In my handler I have now:
>
> my $sth = $dbh->do("LOCK TABLE hits IN SHARE ROW EXCLUSIVE MODE");
> my $sth = $dbh->do("SELECT acc_hits($1)") || die $dbh->errstr;
>
> am I right ?
You should run LOCK and SELECT inside BEGIN/END (i.e. in
the same transaction), do you?
Vadim
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Oleg Bartunov | 1999-07-26 06:28:57 | Re: [HACKERS] Re: [SQL] inserts/updates problem understressing ! |
| Previous Message | Oleg Bartunov | 1999-07-26 06:15:46 | Re: [HACKERS] don't lose me :) |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Molnar Laszlo | 1999-07-26 06:28:48 | LEFT JOIN and ODBC |
| Previous Message | Oleg Bartunov | 1999-07-26 06:13:54 | Re: [SQL] inserts/updates problem under stressing ! |