Home > database >  The data query after the application of the order by special slow, help me to look at it
The data query after the application of the order by special slow, help me to look at it

Time:09-27

SQL statements are as follows:

Sort the two fields is added the index,
But now get rid of the second sort field is very fast, and it is slow,
What should I do with it?
Great god look

CodePudding user response:

I try to total_weigh create indexes can be not?

CodePudding user response:

Ordering from two tables, so can't fully make use of the index

CodePudding user response:

# @ ZJCXC - personal WeChat public name this kind of situation can write SQL to optimize don't again

CodePudding user response:

refer to the second floor ZJCXC response:
sort from two tables, so can't completely use index

This kind of situation can write SQL to optimize don't again

CodePudding user response:

I'd suggest implement step by step, such as the first step, the query results and then meet the conditions and other table to join

CodePudding user response:

Try to put the join condition in the where

CodePudding user response:

Left join line_manage e table is why, didn't see you query the fields in the table, sorting fields from two tables, can result in these two fields above index fails, if the condition allows the implementation step by step, the efficiency may be faster

CodePudding user response:

I feel should be queried respectively, finally put the collection in together
  • Related