Home > database > Query to modify slow, how to optimize
Query to modify slow, how to optimize
Time:12-23
I originally did this, because a role_id, corresponding to multiple gw_type, a corresponding four search_type gw_type, so a part of a document type in table form has four data, only modify search_type changes, and other fields, the back when I was in the preservation, according to role_id and gw_type first, if there is a data query to list, any modifications, if not new, but this check a judge a save a slow, how to improve the speed?
CodePudding user response:
Because there's no merge into statements in the MSSQL mysql, so before you save to do judgment, you look at ON the DUPLICATE KEY UPDATE whether meet your requirements, if you don't need, then only write if the exists (... ) do something else do something,