-
Notifications
You must be signed in to change notification settings - Fork 2.3k

Description
I'm sorry for the newbie question.
From what I've read it seems that each database/sql Query / Exec with args that I issue is prepared, executed, and closed on the server, resulting in 3 round-trips. And I can avoid that behavior by setting interpolateParams=true. Are there any downsides to setting interpolateParams to true? If I don't set it and a prepared statement is created behind the scenes as a result of issuing a Query / Exec, and later another Query / Exec with the same text is issued, does the driver remember the earlier-prepared statement? As far as I can tell it doesn't, and another Prepare call is made to the server, so it seems that the prepared statement that is created behind the scenes as a result of issuing a Query / Exec is single-use only, which seems wasteful.
Also, I'm thinking that if I've set interpolateParams=true and I want to create and re-use a prepared statement, I can still call Prepare in my code to create the prepared statement.
Am I looking at this correctly?