Re: [HACKERS] Single client performance on trivial SELECTs

2011-04-15 Thread Kevin Grittner
Greg Smith wrote: > I'm not sure exactly what is useful to be learned from that > specific work. But it does suggest two things: one, this is far > from an easy thing to fix. Two, the only reason MySQL does so > well on it is because there was some focused work on it, taking a > quite a while

Re: [HACKERS] Single client performance on trivial SELECTs

2011-04-15 Thread Greg Smith
I did some more research into the memory allocation hotspots found in the profile, in regards to what MySQL has done in those areas. (And by "research" I mean "went to the bar last night and asked Baron about it") The issue of memory allocation being a limiter on performance has been nagging

Re: [HACKERS] Single client performance on trivial SELECTs

2011-04-15 Thread Tom Lane
Joshua Berkus writes: > Certainly any sacrifice of functionality in order to be faster at that kind > of trivial workload would be foolhardy. Yeah, and I'd further say that any sacrifice of maintainability would be equally foolhardy. In particular I'm repelled by David's proposal of a whole par

Re: [HACKERS] Single client performance on trivial SELECTs

2011-04-15 Thread Joshua D. Drake
On 04/15/2011 09:59 AM, Joshua Berkus wrote: All, While it would be nice to improve our performance on this workload, let me point out that it's not a very important workload from the point of view of real performance challenges. Yes, there are folks out there with 100MB databases who only r

Re: [HACKERS] Single client performance on trivial SELECTs

2011-04-15 Thread Joshua Berkus
All, While it would be nice to improve our performance on this workload, let me point out that it's not a very important workload from the point of view of real performance challenges. Yes, there are folks out there with 100MB databases who only run one-liner select queries. But frankly, Val

Re: [HACKERS] Single client performance on trivial SELECTs

2011-04-15 Thread Tom Lane
Noah Misch writes: > On Thu, Apr 14, 2011 at 05:10:41PM -0400, Tom Lane wrote: >> FWIW, mysql used to use gperf for this purpose, but they've abandoned it >> in favor of some homegrown hashing scheme. > Do you have any details, like when mysql did this? With a quick look, I'm > failing to find c

Re: [HACKERS] Single client performance on trivial SELECTs

2011-04-15 Thread David Fetter
On Thu, Apr 14, 2011 at 11:16:03PM -0400, Tom Lane wrote: > David Fetter writes: > > On Thu, Apr 14, 2011 at 10:43:16AM -0400, Tom Lane wrote: > >> ... I think a lot of this ultimately traces to the extensible, > >> data-type-agnostic design philosophy. The fact that we don't > >> know what an in

Re: [HACKERS] Single client performance on trivial SELECTs

2011-04-15 Thread Noah Misch
On Thu, Apr 14, 2011 at 05:10:41PM -0400, Tom Lane wrote: > Noah Misch writes: > > On Thu, Apr 14, 2011 at 11:15:00AM -0700, Robert Haas wrote: > >> It shouldn't be > >> terribly difficult to come up with some kind of hash function based > >> on, say, the first two characters of the keyword that w

Re: [HACKERS] Single client performance on trivial SELECTs

2011-04-15 Thread Heikki Linnakangas
On 14.04.2011 23:02, Tom Lane wrote: Heikki Linnakangas writes: There's one very low-hanging fruit here, though. I profiled the pgbench case, with -M prepared, and found that like in Greg Smith's profile, hash_seq_search pops up quite high in the list. Those calls are coming from LockReleaseAll

Re: [HACKERS] Single client performance on trivial SELECTs

2011-04-14 Thread Tom Lane
David Fetter writes: > On Thu, Apr 14, 2011 at 10:43:16AM -0400, Tom Lane wrote: >> ... I think a lot of this ultimately >> traces to the extensible, data-type-agnostic design philosophy. The >> fact that we don't know what an integer is until we look in pg_type, >> and don't know what an "=" ope

Re: [HACKERS] Single client performance on trivial SELECTs

2011-04-14 Thread Andres Freund
On Thursday 14 April 2011 23:10:41 Tom Lane wrote: > Noah Misch writes: > > On Thu, Apr 14, 2011 at 11:15:00AM -0700, Robert Haas wrote: > >> It shouldn't be > >> terribly difficult to come up with some kind of hash function based > >> on, say, the first two characters of the keyword that would be

Re: [HACKERS] Single client performance on trivial SELECTs

2011-04-14 Thread Merlin Moncure
On Thu, Apr 14, 2011 at 4:10 PM, Tom Lane wrote: > Noah Misch writes: >> On Thu, Apr 14, 2011 at 11:15:00AM -0700, Robert Haas wrote: >>> It shouldn't be >>> terribly difficult to come up with some kind of hash function based >>> on, say, the first two characters of the keyword that would be a lo

Re: [HACKERS] Single client performance on trivial SELECTs

2011-04-14 Thread Tom Lane
Noah Misch writes: > On Thu, Apr 14, 2011 at 11:15:00AM -0700, Robert Haas wrote: >> It shouldn't be >> terribly difficult to come up with some kind of hash function based >> on, say, the first two characters of the keyword that would be a lot >> faster than what we're doing now. > I'd look at `g

Re: [HACKERS] Single client performance on trivial SELECTs

2011-04-14 Thread Robert Haas
On Thu, Apr 14, 2011 at 12:45 PM, Noah Misch wrote: >> It shouldn't be >> terribly difficult to come up with some kind of hash function based >> on, say, the first two characters of the keyword that would be a lot >> faster than what we're doing now. > > I'd look at `gperf', which generates code f

Re: [HACKERS] Single client performance on trivial SELECTs

2011-04-14 Thread Tom Lane
Andres Freund writes: > Where I am with you is that its quite possible that it will not make sense > (performancewise) for all contexts. Which is quite annoying. The mcxt stuff was designed from day one to support multiple types of contexts, so it wouldn't be very hard at all to have different c

Re: [HACKERS] Single client performance on trivial SELECTs

2011-04-14 Thread Andres Freund
On Thursday 14 April 2011 22:21:26 Alvaro Herrera wrote: > Excerpts from Andres Freund's message of jue abr 14 17:08:34 -0300 2011: > > Hi, > > > > On Thursday 14 April 2011 16:43:16 Tom Lane wrote: > > > I doubt that it's possible to make AllocSetAlloc radically cheaper. > > > > I actually doubt

Re: [HACKERS] Single client performance on trivial SELECTs

2011-04-14 Thread Merlin Moncure
On Thu, Apr 14, 2011 at 2:08 AM, Greg Smith wrote: > This week several list regulars here waded into the MySQL Convention.  I > decided to revisit PostgreSQL vs. MySQL performance using the sysbench > program as part of that.  It's not important to what I'm going to describe > to understand exactl

Re: [HACKERS] Single client performance on trivial SELECTs

2011-04-14 Thread Greg Smith
Heikki Linnakangas wrote: In this case you could just use prepared statements and get rid of all the parser related overhead, which includes much of the allocations. Trying that gives me around 9200 TPS instead of 5500 on my laptop, so a pretty big gain here. Will have to include that in my n

Re: [HACKERS] Single client performance on trivial SELECTs

2011-04-14 Thread Alvaro Herrera
Excerpts from Andres Freund's message of jue abr 14 17:08:34 -0300 2011: > Hi, > > On Thursday 14 April 2011 16:43:16 Tom Lane wrote: > > I doubt that it's possible to make AllocSetAlloc radically cheaper. > I actually doubt your doubt. I think you could add some SLAB like interface > for common

Re: [HACKERS] Single client performance on trivial SELECTs

2011-04-14 Thread Andres Freund
Hi, On Thursday 14 April 2011 16:43:16 Tom Lane wrote: > I doubt that it's possible to make AllocSetAlloc radically cheaper. I actually doubt your doubt. I think you could add some SLAB like interface for common allocation sizes making it significantly faster for some uses (because allocation/de

Re: [HACKERS] Single client performance on trivial SELECTs

2011-04-14 Thread Tom Lane
Heikki Linnakangas writes: > There's one very low-hanging fruit here, though. I profiled the pgbench > case, with -M prepared, and found that like in Greg Smith's profile, > hash_seq_search pops up quite high in the list. Those calls are coming > from LockReleaseAll(), where we scan the local l

Re: [HACKERS] Single client performance on trivial SELECTs

2011-04-14 Thread Noah Misch
On Thu, Apr 14, 2011 at 11:15:00AM -0700, Robert Haas wrote: > It's fairly far down in the noise on this particular profile, but in > the low-hanging fruit department, I think we should fix > ScanKeywordLookup to use a smarter algorithm that is more like O(1) > rather than O(lg n) in the number of

Re: [HACKERS] Single client performance on trivial SELECTs

2011-04-14 Thread Heikki Linnakangas
On 14.04.2011 17:43, Tom Lane wrote: Greg Smith writes: samples %image name symbol name 53548 6.7609 postgres AllocSetAlloc 32787 4.1396 postgres MemoryContextAllocZeroAligned 26330 3.3244 postgres base_yypars

Re: [HACKERS] Single client performance on trivial SELECTs

2011-04-14 Thread Robert Haas
On Thu, Apr 14, 2011 at 7:43 AM, Tom Lane wrote: > I doubt that it's possible to make AllocSetAlloc radically cheaper. > I think the more likely route to improvement there is going to be to > find a way to do fewer pallocs.  For instance, if we had more rigorous > rules about which data structures

Re: [HACKERS] Single client performance on trivial SELECTs

2011-04-14 Thread David Fetter
On Thu, Apr 14, 2011 at 10:43:16AM -0400, Tom Lane wrote: > > I doubt that it's possible to make AllocSetAlloc radically cheaper. > I think the more likely route to improvement there is going to be to > find a way to do fewer pallocs. For instance, if we had more rigorous > rules about which data

Re: [HACKERS] Single client performance on trivial SELECTs

2011-04-14 Thread Tom Lane
Greg Smith writes: > samples %image name symbol name > 53548 6.7609 postgres AllocSetAlloc > 32787 4.1396 postgres MemoryContextAllocZeroAligned > 26330 3.3244 postgres base_yyparse > 21723 2.7427 postgres

[HACKERS] Single client performance on trivial SELECTs

2011-04-14 Thread Greg Smith
This week several list regulars here waded into the MySQL Convention. I decided to revisit PostgreSQL vs. MySQL performance using the sysbench program as part of that. It's not important to what I'm going to describe to understand exactly what statements sysbench runs here or how to use it, b