Re: [PERFORM] Does setval(nextval()+N) generate unique blocks of IDs?

2012-08-21 Thread Scott Marlowe
On Mon, Aug 20, 2012 at 7:06 PM, Scott Marlowe scott.marl...@gmail.com wrote: On Mon, Aug 20, 2012 at 6:59 PM, Scott Marlowe scott.marl...@gmail.com wrote: On Mon, Aug 20, 2012 at 6:10 PM, Tom Lane t...@sss.pgh.pa.us wrote: Craig James cja...@emolecules.com writes: I want to do this:

Re: [PERFORM] Does setval(nextval()+N) generate unique blocks of IDs?

2012-08-21 Thread Scott Marlowe
On Tue, Aug 21, 2012 at 1:41 AM, Scott Marlowe scott.marl...@gmail.com wrote: On Mon, Aug 20, 2012 at 7:06 PM, Scott Marlowe scott.marl...@gmail.com wrote: On Mon, Aug 20, 2012 at 6:59 PM, Scott Marlowe scott.marl...@gmail.com wrote: On Mon, Aug 20, 2012 at 6:10 PM, Tom Lane

Re: [PERFORM] Does setval(nextval()+N) generate unique blocks of IDs?

2012-08-21 Thread Merlin Moncure
On Tue, Aug 21, 2012 at 2:45 AM, Scott Marlowe scott.marl...@gmail.com wrote: sometimes I hate my laptops touchpad. Ran something similar in php got similar performance. By comparison, running select 1 instead of nextval() took ~0.160s to run. you're mostly measuring client overhead i think:

Re: [PERFORM] Does setval(nextval()+N) generate unique blocks of IDs?

2012-08-21 Thread Craig James
On Mon, Aug 20, 2012 at 6:06 PM, Scott Marlowe scott.marl...@gmail.com wrote: On Mon, Aug 20, 2012 at 6:59 PM, Scott Marlowe scott.marl...@gmail.com wrote: On Mon, Aug 20, 2012 at 6:10 PM, Tom Lane t...@sss.pgh.pa.us wrote: Craig James cja...@emolecules.com writes: I want to do this:

Re: [PERFORM] Does setval(nextval()+N) generate unique blocks of IDs?

2012-08-21 Thread Craig James
On Mon, Aug 20, 2012 at 5:10 PM, Tom Lane t...@sss.pgh.pa.us wrote: Craig James cja...@emolecules.com writes: I want to do this: select setval('object_id_seq', nextval('object_id_seq') + 1000, false); Now suppose two processes do this simultaneously. Maybe they're in transactions,

Re: [PERFORM] Does setval(nextval()+N) generate unique blocks of IDs?

2012-08-21 Thread Merlin Moncure
On Tue, Aug 21, 2012 at 10:32 AM, Craig James cja...@emolecules.com wrote: On Mon, Aug 20, 2012 at 5:10 PM, Tom Lane t...@sss.pgh.pa.us wrote: Craig James cja...@emolecules.com writes: I want to do this: select setval('object_id_seq', nextval('object_id_seq') + 1000, false); Now suppose

[PERFORM] average query performance measuring

2012-08-21 Thread Rick Otten
I have a PostgreSQL 9.1 cluster. Each node is serving around 1,000 queries per second when we are at a 'steady state'. What I'd like to know is the average query time. I'd like to see if query performance is consistent, or if environmental changes, or code releases, are causing it to drift,

Re: [PERFORM] average query performance measuring

2012-08-21 Thread Stephen Frost
* Rick Otten (rot...@manta.com) wrote: It seems like we almost have everything we need to track this in the stats tables, but not quite. I was hoping the folks on this list would have some tips on how to get query performance trends over time out of each node in my cluster. I'm afraid the

Re: [PERFORM] average query performance measuring

2012-08-21 Thread Karl Denninger
On 8/21/2012 1:53 PM, Stephen Frost wrote: * Rick Otten (rot...@manta.com) wrote: It seems like we almost have everything we need to track this in the stats tables, but not quite. I was hoping the folks on this list would have some tips on how to get query performance trends over time out

Re: [PERFORM] Does setval(nextval()+N) generate unique blocks of IDs?

2012-08-21 Thread Scott Marlowe
On Tue, Aug 21, 2012 at 9:32 AM, Craig James cja...@emolecules.com wrote: On Mon, Aug 20, 2012 at 5:10 PM, Tom Lane t...@sss.pgh.pa.us wrote: Craig James cja...@emolecules.com writes: I want to do this: select setval('object_id_seq', nextval('object_id_seq') + 1000, false); Now suppose

Re: [PERFORM] Does setval(nextval()+N) generate unique blocks of IDs?

2012-08-21 Thread Scott Marlowe
On Tue, Aug 21, 2012 at 2:03 PM, Scott Marlowe scott.marl...@gmail.com wrote: On Tue, Aug 21, 2012 at 9:32 AM, Craig James cja...@emolecules.com wrote: On Mon, Aug 20, 2012 at 5:10 PM, Tom Lane t...@sss.pgh.pa.us wrote: Craig James cja...@emolecules.com writes: I want to do this: select

Re: [PERFORM] average query performance measuring

2012-08-21 Thread Stephen Frost
Karl, * Karl Denninger (k...@denninger.net) wrote: That looks EXTREMELY useful and I'm looking forward to checking it out in 9.2; I have asked a similar question about profiling actual queries in the past and basically it came down to turn on explain or run a separate explain yourself since

Re: [PERFORM] Does setval(nextval()+N) generate unique blocks of IDs?

2012-08-21 Thread Craig James
On Tue, Aug 21, 2012 at 1:03 PM, Scott Marlowe scott.marl...@gmail.com wrote: That seems unnecessarily complex. how about this: create sequence s; select array_agg (a.b) from (select nextval('s') as b from generate_series(1,1000)) as a; Then you just iterate that array for the ids you

Re: [PERFORM] Does setval(nextval()+N) generate unique blocks of IDs?

2012-08-21 Thread Scott Marlowe
On Tue, Aug 21, 2012 at 2:59 PM, Craig James cja...@emolecules.com wrote: On Tue, Aug 21, 2012 at 1:03 PM, Scott Marlowe scott.marl...@gmail.com wrote: That seems unnecessarily complex. how about this: create sequence s; select array_agg (a.b) from (select nextval('s') as b from

Re: [PERFORM] average query performance measuring

2012-08-21 Thread Tomas Vondra
On 21.8.2012 20:35, Rick Otten wrote: I have a PostgreSQL 9.1 cluster. Each node is serving around 1,000 queries per second when we are at a ‘steady state’. What I’d like to know is the average query time. I’d like to see if query performance is consistent, or if environmental changes, or

Re: [PERFORM] average query performance measuring

2012-08-21 Thread Peter Geoghegan
On 21 August 2012 22:08, Tomas Vondra t...@fuzzy.cz wrote: As others already mentioned, the improvements in pg_stat_statements by Peter Geoghean in 9.2 is the first thing you should look into I guess. Especially if you're looking for per-query stats. If people would like to know about a better

[PERFORM] Performance of Seq Scan from buffer cache

2012-08-21 Thread Matt Daw
Howdy. I'm curious what besides raw hardware speed determines the performance of a Seq Scan that comes entirely out of shared buffers… I ran the following on the client's server I'm profiling, which is otherwise idle: EXPLAIN (ANALYZE ON, BUFFERS ON) SELECT * FROM notes; Seq Scan on notes

Re: [PERFORM] Performance of Seq Scan from buffer cache

2012-08-21 Thread Matt Daw
Ugh, never mind. I ran ltrace and it's spending 99% of its time in gettimeofday. select count(*) from notes; count - 1926207 (1 row) Time: 213.950 ms explain analyze select count(*) from notes; QUERY PLAN