4 ms·
I'd be curious as to why exactly the SQLAlchemy query was slower than the raw one. I get that there's gonna be some overhead, but did you figure out exactly wha
by smcl 10y ago
I'd be curious as to why exactly the SQLAlchemy query was slower than the raw one. I get that there's gonna be some overhead, but did you figure out exactly what was slowing it down?
- Qantourisc 10y agoI have been comparing the 2, at third glance they don't even appear the be the same query. Second for performance as much as possible from the SQL building should be outside the function. Also if the query is that static, you should probably use the plain SQL anyway ;) Or maybe even build the SQL query string by using SQL alchemy outside the function, and then using the SQL generated by SQLAlchemy inside the function (if you don't like pure SQL, like for example compatibility).