New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generating queries can be quadratic in time #70
Comments
Ok, I did a bit of information gathering and discovered that mysql-simple does not exhibit this bug, while even version 0.0 of postgresql-simple does. I find this slightly surprising as I didn't change Bryan's query generation code too much; I was expecting this problem to have either been introduced sometime after the first release or inherited from mysql-simple, but clearly I did something wrong in the initial port. |
Whatever the problem is, at least some of it appears to be inside either the libpq C library and/or the postgresql-libpq haskell binding. This appears to exhibit non-linear behavior, though perhaps not quite quadratic, as doubling the number of escaped strings takes about 3x longer:
|
Ok, I fixed up postgresql-libpq's binding to escapeStringConn, and the performance looks a lot more reasonable. I'm going to call this bug closed for now. |
Possibly related to #39, it appears as though query generation is quadratic when it involves escaping via libpq's
escapeStringConn
command. Here's a simple test case that reproduces the behavior:Note that this isn't a problem if you replace
show i
by say,i^2
or whatnot.The text was updated successfully, but these errors were encountered: