Re: PostgreSQL as a local in-memory cache

Поиск
Список
Период
Сортировка
Искать
От
Jonathan Gardner
Тема
Re: PostgreSQL as a local in-memory cache
Дата
Msg-id
AANLkTikFERJoyWCOBuf5ECvHhxiSCQZPFlBNfP-zkPMd@mail.gmail.com
Ответ на
Список
Дерево обсуждения
Re: PostgreSQL as a local in-memory cache Chris Browne <cbbrowne@acm.org>
Re: PostgreSQL as a local in-memory cache Josh Berkus <josh@agliodbs.com>
Re: PostgreSQL as a local in-memory cache Jaime Casanova <jaime@2ndquadrant.com>
On Wed, Jun 16, 2010 at 4:22 AM, Pierre C  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@jonathangardner.net
В списке pgsql-performance по дате отправления
От: Jonathan Gardner
Дата:
От: Jonathan Gardner
Дата:
FAQ