mysql power buckle database topic 620 interesting movie optimization records


I have nothing to do to brush the database title of Likou, title number 620: Interesting movie, the following is the title description:

SQL and execution time before optimization:

Optimized sql and execution time:

The filter conditions are optimized here:

1. The search efficiency of select * is higher than that of field-by-field search

2. Bit operation is used to find the remainder. id & 1 is to compare the last binary digit of id with 1: when id is odd, both of them are 1, and 1 is returned; when id is even, these two are different just return 0

3. The efficiency of using not is faster than <>

Recommended Today

It’s numb, the code is changed to multi-threaded, there are 9 major problems

foreword In many cases, in order to improve the performance of the interface, we willsingle thread synchronizationThe code to execute is changed toMulti-threaded asynchronousimplement. For example, the interface for querying user information needs to return basic user information, point information, and growth value information, while users, points, and growth value need to call different interfaces […]