Re: [GENERAL] Thousands of semops for every i/o - Mailing list pgsql-patches

From Bruce Momjian
Subject Re: [GENERAL] Thousands of semops for every i/o
Date
Msg-id 200306242318.h5ONIOV03160@candle.pha.pa.us
Whole thread Raw
List pgsql-patches
Attached patch applied.  Thanks.

---------------------------------------------------------------------------

Jeffrey W. Baker wrote:
> On Mon, 2003-06-09 at 23:08, Tom Lane wrote:
> > "Jeffrey W. Baker" <jwbaker@acm.org> writes:
> > > This is the strace of a process which is deleting rows from four tables,
> > > inside a transaction, one row at a time.  There are a lot of semops for
> > > every i/o.  There are about 30 connections to this database currently.
> > > I thought deletes in a transaction just flew along in Pg, because they
> > > simply wrote the deleted transaction ID on the record.  It used to work
> > > fine in my previous locally-built 7.2 on Debian, but this is 7.2.2 on
> > > SuSE Enterprise Server 8.2.
> >
> > The first thing that comes to mind is that the thing is using SysV
> > semaphores as a substitute for spinlocks.  If this is on a hardware
> > platform that is supposed to have TAS() support in s_lock.h or s_lock.c,
> > then it's a configuration or build error.  If it's on some heretofore
> > unknown platform, you need to write some TAS() code to get decent
> > performance.
>
> It looks like a simple change in s_lock.h from
>
> #if defined(__i386__)
>
> to
>
> #if defined(__i386__) || defined(__x86_64__)
>
> Will be necessary for this platform.
>
> Thanks,
> jwb
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
>

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
Index: src/include/storage/s_lock.h
===================================================================
RCS file: /cvsroot/pgsql-server/src/include/storage/s_lock.h,v
retrieving revision 1.107
diff -c -c -r1.107 s_lock.h
*** src/include/storage/s_lock.h    5 Jun 2003 16:07:25 -0000    1.107
--- src/include/storage/s_lock.h    24 Jun 2003 23:17:03 -0000
***************
*** 94,100 ****
   */


! #if defined(__i386__)
  #define TAS(lock) tas(lock)

  static __inline__ int
--- 94,100 ----
   */


! #if defined(__i386__) || defined(__x86_64__)
  #define TAS(lock) tas(lock)

  static __inline__ int
***************
*** 110,116 ****
      return (int) _res;
  }

! #endif     /* __i386__ */


  #ifdef __ia64__
--- 110,116 ----
      return (int) _res;
  }

! #endif     /* __i386__ || __x86_64__ */


  #ifdef __ia64__

pgsql-patches by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: array support patch phase 1 patch
Next
From: Bruce Momjian
Date:
Subject: Re: perform.sgml update