Repository navigation
Is it possible to disable optimisations? #6045
|
Describe your question Am I right in think that sqlalchemy will deduplicate select and update statements when they don't achieve anything? For example: I'm assuming the object is cached in the first case, so this results in only 1 SELECT statement sent to the DB? Here, the attribute is being assigned the same value it already has, so I'm assuming no UPDATE statement is sent to the DB? If that's correct, is there any way to disable these optimisations? It seems they are causing failures for a benchmarking tool, which expect the exact same number of statements to be sent for each run (it uses random values which can result in collisions shown in the above examples). Additional context |
Replies: 3 comments 4 replies
|
Hi, For the get statement you can refer to the session.get documentation. |
|
the unit of work flush process works based on net changes to an object so there is no "optimisation" that could occur here, other than having it emit UPDATE statements that includes every column in the table every time the object was pinged for flush. the issue would appear to be with your benchmarking tool that expects identical behavior based on non-deterministic inputs and I would recommend adjusting that side of things. |
|
On an unrelated note (as the issue has been locked), it appears that asyncpg has about half the performance (compared to the fake async psycopg on beta1). Even though the documentation suggests it's 3x faster than psycopg2. |
Hi,
For the get statement you can refer to the session.get documentation.
Regarding the update, you can use the update statement directly