Re: gprof SELECT COUNT(*) results

From: Greg Stark <gsstark(at)mit(dot)edu>
To: Qingqing Zhou <zhouqq(at)cs(dot)toronto(dot)edu>
Cc: Simon Riggs <simon(at)2ndquadrant(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: gprof SELECT COUNT(*) results
Date: 2005-11-25 03:23:15
Message-ID: 87veyhjtr0.fsf@stark.xeocode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


Qingqing Zhou <zhouqq(at)cs(dot)toronto(dot)edu> writes:

> Yeah, understood. What I can't understand that in this case why it costs
> so much -- without concurrency, the LWLock code path just invloves
> spinlock_lock/unlock and serveral simple instructions?

You executed LWLock 2.6 million times in just under 300ms. If my math is right
that's about 115 nanoseconds per lock or about 300 cycles on a 2.6Ghz
processor.

That sounds like a lot but it's about the right order of magnitude. Was this
on a multiprocessor machine? In which case a big part of that time is probably
spent synchronizing between the processors.

--
greg

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Qingqing Zhou 2005-11-25 04:02:37 Re: gprof SELECT COUNT(*) results
Previous Message Tom Lane 2005-11-25 02:49:11 Re: NULL safe equality operator