The from order_data. Data_orders as o
Left the join billstable_data. Data_inexpenses as I on i.o rdernum=o.o rdernum
Left the join members_data. Data_users as u on u.u serid=o.u serid
Left the join members_data. Data_users as u1 on (o.i mportid=u1. Userid or u.t opRecommend=u1. Userid)
Left the join members_data. Data_user_detail AS ud ON u.u serid=ud. Userid
Where o.p ayTime & gt;=849369600 and o.p ayTime & lt;=1451577599
And ((u1. IsManages=1 and o.i nDate & gt; U1. BecomeManageTime) or (u.i sManages=1 AND o.i nDate & gt; U.b ecomeManageTime))
And o.p ayStatus=2 and IFNULL (i.i smanager, 1) & lt;> '0'
Group by o.o rdernum
The ORDER by desc o.i d limit of 90000
CodePudding user response:
Now the problem has nothing to do with the index!If you really want to build indexes, the standard SQL is the CREATE INDEX command, specific methods and database related
CodePudding user response:
In fact most of the time is not indexed in the program, because most of the time is a library and table design by manager, designer index, in addition to the dynamic table to dynamic index is establishedCodePudding user response:
Key to this query is too slow, do not know how to optimize the better.CodePudding user response:
Can be indexed in the design of the SQL server list, don't have to write the create index, in the where clause of the first condition index is built on the field is the paytime, you can use the "display implementation plan", you can see which step spends much of her time, in spend time more index is built on the table