G
G
gpm73152018-02-24 23:09:50
MySQL
gpm7315, 2018-02-24 23:09:50

Improving the efficiency of executing SQL queries using prepared statement in MySQL?

In python (mysql.connector), to work with prepared statements, you need to create a cursor with the prepared=True parameter, and when you call .execute(), a prepared query will be created and then executed. For all subsequent SAME requests, the prepared request will be immediately accessed (EXECUTE stmt USING ...)
I.e. within the cursor, a reference to the prepared statement of only the last executed expression is stored.
If the next request differs from the previous one, the last prepared statement will be deleted and a new one created for the current request.
Why is storage of references to all previously created prepared statements not implemented?
Does it make sense to implement it yourself?
In theory, then each parameterized query will be "cached", which should increase the efficiency of query execution ...
Or is it not?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question