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,

CodePudding user response:

reference 1st floor chengangcsdn response:
because 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 the if the exists (... ) do something else do something.

Time after I test many times, the reason of the slow, when save each save a did want to go to the garage to check the data and time consuming in here, then I changed, not to check, according to the field to the garage to valid tags directly, also slowly
  • Related