Re: schema/db design wrt performance

From: Ron Johnson <ron(dot)l(dot)johnson(at)cox(dot)net>
To: PgSQL Performance ML <pgsql-performance(at)postgresql(dot)org>
Subject: Re: schema/db design wrt performance
Date: 2003-01-16 16:25:36
Message-ID: 1042734336.892.42.camel@haggis
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Thu, 2003-01-16 at 10:02, Stephan Szabo wrote:
> On 16 Jan 2003, Ron Johnson wrote:
>
> > On Thu, 2003-01-16 at 09:39, Andrew Sullivan wrote:
> > > On Thu, Jan 16, 2003 at 08:34:38AM -0600, Ron Johnson wrote:
> > > > On Thu, 2003-01-16 at 08:20, Andrew Sullivan wrote:
> > >
> > > > > If a user has multiple connections and charges things to the same
> > > > > account in more than one connection at the same time, the
> > > > > transactions will have to be processed, effectively, in series: each
> > > > > one will have to wait for another to commit in order to complete.
> > > >
> > > > This is true even though the default transaction mode is
> > > > READ COMMITTED?
> > >
> > > Yes. Remember, _both_ of these are doing SELECT. . .FOR UPDATE.
> > > Which means they both try to lock the corresponding record. But they
> > > can't _both_ lock the same record; that's what the lock prevents.
> >
> > Could BEFORE INSERT|UPDATE|DELETE triggers perform the same
> > functionality while touching only the desired records, thus
> > decreasing conflict?
>
> It does limit it to the corresponding records, but if you
> say insert a row pointing at customer 1, and in another transaction
> insert a row pointing at customer 1, the second waits on the first.

2 points:

1. Don't you *want* TXN2 to wait on TXN1?
2. In an OLTP environment (heck, in *any* environment), the goal
is to minimize txn length, so TXN2 shouldn't be waiting on
TXN1 for more than a fraction of a second anyway.

Am I missing something?

--
+------------------------------------------------------------+
| Ron Johnson, Jr. mailto:ron(dot)l(dot)johnson(at)cox(dot)net |
| Jefferson, LA USA http://members.cox.net/ron.l.johnson |
| |
| "Basically, I got on the plane with a bomb. Basically, I |
| tried to ignite it. Basically, yeah, I intended to damage |
| the plane." |
| RICHARD REID, who tried to blow up American Airlines |
| Flight 63 |
+------------------------------------------------------------+

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Stephan Szabo 2003-01-16 16:38:08 Re: schema/db design wrt performance
Previous Message Bruce Momjian 2003-01-16 16:18:35 Re: 7.3.1 New install, large queries are slow