Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 32B7B6331BA for ; Wed, 16 Jun 2010 15:30:42 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 18858-07 for ; Wed, 16 Jun 2010 18:30:34 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from 29.mail-out.ovh.net (29.mail-out.ovh.net [87.98.216.213]) by mail.postgresql.org (Postfix) with SMTP id 86F16632E4D for ; Wed, 16 Jun 2010 15:30:34 -0300 (ADT) Received: (qmail 14559 invoked by uid 503); 16 Jun 2010 11:28:23 -0000 Received: from b9.ovh.net (HELO mail644.ha.ovh.net) (213.186.33.59) by 29.mail-out.ovh.net with SMTP; 16 Jun 2010 11:28:23 -0000 Received: from b0.ovh.net (HELO queueout) (213.186.33.50) by b0.ovh.net with SMTP; 16 Jun 2010 13:23:52 +0200 Received: from par69-8-88-161-102-87.fbx.proxad.net (HELO apollo13) (lists%peufeu.com@88.161.102.87) by ns0.ovh.net with SMTP; 16 Jun 2010 13:23:50 +0200 Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes To: "Greg Smith" , "jgardner@jonathangardner.net" Cc: pgsql-performance@postgresql.org Subject: Re: PostgreSQL as a local in-memory cache References: <87bpbcpabg.fsf@cbbrowne-laptop.afilias-int.info> <4C17A417.2040600@noao.edu> <87ocfcnqmk.fsf@cbbrowne-laptop.afilias-int.info> <4C180A3B.7090905@agliodbs.com> <4634b12c-749f-4605-9d95-121b8e2bd9e4@k17g2000pro.googlegroups.com> <4C188AD4.20209@2ndquadrant.com> Date: Wed, 16 Jun 2010 13:22:50 +0200 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: "Pierre C" Message-ID: In-Reply-To: <4C188AD4.20209@2ndquadrant.com> User-Agent: Opera Mail/10.10 (Linux) X-Ovh-Tracer-Id: 12990070176225887895 X-Ovh-Remote: 88.161.102.87 (par69-8-88-161-102-87.fbx.proxad.net) X-Ovh-Local: 213.186.33.20 (ns0.ovh.net) X-Spam-Check: DONE|U 0.5/N X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-10 required=5 tests=BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001 X-Spam-Level: X-Archive-Number: 201006/284 X-Sequence-Number: 39140 FYI I've tweaked this program a bit : import psycopg2 from time import time conn = psycopg2.connect(database='peufeu') cursor = conn.cursor() cursor.execute("CREATE TEMPORARY TABLE test (data int not null)") conn.commit() cursor.execute("PREPARE ins AS INSERT INTO test VALUES ($1)") cursor.execute("PREPARE sel AS SELECT 1") conn.commit() start = time() tx = 0 N = 100 d = 0 while d < 10: for n in xrange( N ): cursor.execute("EXECUTE ins(%s)", (tx,)); #~ conn.commit() #~ cursor.execute("EXECUTE sel" ); conn.commit() d = time() - start tx += N print "result : %d tps" % (tx / d) cursor.execute("DROP TABLE test"); conn.commit(); Results (Core 2 quad, ubuntu 10.04 64 bits) : SELECT 1 : 21000 queries/s (I'd say 50 us per query isn't bad !) INSERT with commit every 100 inserts : 17800 insets/s INSERT with commit every INSERT : 7650 tps fsync is on but not synchronous_commit.