Re: Psycopg and prepared SQL statements

From: Nicolas Boullis <postgresql(at)ilcode(dot)fr>
To: Christophe Pettus <xof(at)thebuild(dot)com>
Cc: psycopg(at)postgresql(dot)org
Subject: Re: Psycopg and prepared SQL statements
Date: 2014-05-16 12:34:21
Message-ID: 20140516123421.GD3668@tryphon.debian.net
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: psycopg

On Fri, May 16, 2014 at 02:25:14PM +0200, Christophe Pettus wrote:
>
>
> On May 16, 2014, at 2:22 PM, Nicolas Boullis <postgresql(at)ilcode(dot)fr> wrote:
>
> > As performance matters, I am using a ThreadedConnectionPool from
> > psycopg2.pool, but I also want to have my SQL statements prepared.
>
> Why?
>
> This an honest question. In general, prepared statements do not provide significant performance improvements in PostgreSQL.

Well, I benchmarked my webapp without prepared statements, and then
with.
Without prepared statements, I could handle around 70 requests/second.
With prepared statements, I could handle around 140 requests/second.
(And without the connection pool, I could handle around 35
requests/second.)

In my opinion, that’s a good enough reason for me to use prepared
statements.

Cheers,

--
Nicolas Boullis

In response to

Browse psycopg by date

  From Date Subject
Next Message Daniele Varrazzo 2014-05-16 20:59:45 Re: Psycopg and prepared SQL statements
Previous Message Christophe Pettus 2014-05-16 12:25:14 Re: Psycopg and prepared SQL statements