PROPOSAL: disable or delete the display_size calculation code
"James Henstridge" <[email protected]>
| Newsgroups | gmane.comp.python.db.psycopg.devel |
|---|---|
| Message-ID | <[email protected]> |
While reading through the pqpath.c code, I noticed that some pretty
expensive code in _pq_fetch_tuples().
In order to calculate the "display_size" value for Cursor.description,
it iterates over every field value in the result set calling
PQgetlength(). This occurs as part of Cursor.execute() for every
query that returns tuples.
According to Marc-Andre Lemburg, the display_size parameter doesn't
serve much purpose these days, so it seems questionable to spend so
much effort to calculate it:
http://mail.python.org/pipermail/db-sig/2001-February/001539.html
It seems many database adapters just use None for that value,
including pyPgSQL which dropped it after PostgreSQL 7.3 stopped
including the value in its type catalogue (it used to be the typprtlen
column of pg_type):
http://pypgsql.cvs.sourceforge.net/pypgsql/pypgsql/pyPgSQL/PgSQL.py?r1=1.17&r2=1.18
I think we should do one of the following:
1. unset PSYCOPG_DISPLAY_SIZE in the set of default options to disable the code.
2. remove the code entirely.
I'd favour (2), since I find that untested code paths have a habit of
breaking over time. What do you think?
James.