Edgewall Software
Modify

Opened 17 years ago

Closed 17 years ago

#4732 closed defect (fixed)

pypgsql overuses server-side cursors resulting in large performance penalty

Reported by: Jeremy Kemper <jeremy@…> Owned by: Christian Boos
Priority: high Milestone: 0.10.4
Component: general Version: 0.10.3
Severity: major Keywords: pypgsql cursor
Cc: jeremy@… Branch:
Release Notes:
API Changes:
Internal Changes:

Description

Most trac + postgres installs are using pyscopg2 which pulls full result sets for cursor.execute by default.

pypgsql, on the other hand, uses server-side cursors by default, leading to incredibly inefficient queries: rather than fetch e.g. select ... limit 20 all at once, it does declare cursor; fetch 1; fetch 1; ...

Fortunately, server-side cursors can be turned off with great results. I imagine some of pypgsql's widespread perception of slowness with Trac is due to this strange default behavior.

Attachments (1)

pypgsql_cursor_fix.diff (625 bytes ) - added by Jeremy Kemper <jeremy@…> 17 years ago.
disable server-side cursors when using pypgsql

Download all attachments as: .zip

Change History (3)

by Jeremy Kemper <jeremy@…>, 17 years ago

Attachment: pypgsql_cursor_fix.diff added

disable server-side cursors when using pypgsql

comment:1 by Christian Boos, 17 years ago

Owner: changed from Jonas Borgström to Christian Boos
Priority: normalhigh

Thanks for the investigation and the fix!

comment:2 by Christian Boos, 17 years ago

Resolution: fixed
Status: newclosed

Applied in r4754 (trunk) and r4756 (0.10-stable).

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Christian Boos.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Christian Boos to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.