Re: performance issue with psycopg

From: Daniele Varrazzo <daniele(dot)varrazzo(at)gmail(dot)com>
To: sushant354(at)gmail(dot)com
Cc: psycopg(at)postgresql(dot)org
Subject: Re: performance issue with psycopg
Date: 2011-12-12 17:20:01
Message-ID: CA+mi_8YHLsfJw6aXn992tMqQMUS+R5Ke3YNniFDyZBu7on+zXw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: psycopg

On Mon, Dec 12, 2011 at 4:41 PM, Sushant Sinha <sushant354(at)gmail(dot)com> wrote:
> I am using psycopg 2.4.2 and facing performance issue. An explain
> analyze of the query on the database shows 0.75secs. But when used
> through the psycopg layer I am seeing 1.5 secs. Any idea why the extra
> cost and how to optimize it?
>
> from psycopg2.extras import DictCursor
> from psycopg2.extensions import UNICODE, UNICODEARRAY
> psycopg2.extensions.register_type(UNICODE)
> psycopg2.extensions.register_type(UNICODEARRAY)
>
>
> cursor = dbCnx.cursor(cursor_factory=DictCursor)
> cursor.execute(query, params)
> results = cursor.fetchall()

What is the performance using only the basic cursor? And how big is
the returned set?

-- Daniele

In response to

Responses

Browse psycopg by date

  From Date Subject
Next Message Sushant Sinha 2011-12-12 17:46:14 Re: performance issue with psycopg
Previous Message Sushant Sinha 2011-12-12 16:41:22 performance issue with psycopg