开发者

How much slower are prepared statements for single queries?

If prepared sta开发者_如何学Gotements are used to only insert a single row. How much slower would it be compared to not using prepared statements?


Query parsing is not the thing you should be worried about.
Learn to not to ask performance questions prematurely, but only for a reason.
And once having a reason, learn to profile your application and be concerned in the things, really affecting performance.


It just means another round trip to the database, so the difference is minimal.

The query has to be prepared regardless of whether it's done in a separate step or when the query is executed, so by making a prepared statement out of a query that only is executed once, you are only dividing the work of parsing the query into two separate steps.


If you insert a single row only once I suppose it does save some time not to use prepared statements. However, inserting ONE single row cannot be something you'd need to optimize.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜