Edgewall Software

Ticket #4732 (closed defect: fixed)

Opened 22 months ago

Last modified 22 months ago

pypgsql overuses server-side cursors resulting in large performance penalty

Reported by: Jeremy Kemper <jeremy@…> Owned by: cboos
Priority: high Milestone: 0.10.4
Component: general Version: 0.10.3
Severity: major Keywords: pypgsql cursor
Cc: jeremy@…

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

pypgsql_cursor_fix.diff (0.6 KB) - added by Jeremy Kemper <jeremy@…> 22 months ago.
disable server-side cursors when using pypgsql

Change History

Changed 22 months ago by Jeremy Kemper <jeremy@…>

disable server-side cursors when using pypgsql

Changed 22 months ago by cboos

  • owner changed from jonas to cboos
  • priority changed from normal to high

Thanks for the investigation and the fix!

Changed 22 months ago by cboos

  • status changed from new to closed
  • resolution set to fixed

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

Add/Change #4732 (pypgsql overuses server-side cursors resulting in large performance penalty)

Author



Change Properties
<Author field>
Action
as closed
Next status will be 'reopened'
to The owner will change from cboos. Next status will be 'closed'
 
Note: See TracTickets for help on using tickets.