Re: PostgreSQL as a local in-memory cache

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jun 16, 2010 at 4:22 AM, Pierre C <lists@xxxxxxxxxx> wrote:
>
> 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();
>

I'm not surprised that Python add is so slow, but I am surprised that
I didn't remember it was... ;-)

-- 
Jonathan Gardner
jgardner@xxxxxxxxxxxxxxxxxxx

-- 
Sent via pgsql-performance mailing list (pgsql-performance@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance



[Postgresql General]     [Postgresql PHP]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Yosemite]

  Powered by Linux