471,887 Members | 1,265 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,887 software developers and data experts.

SQL condition optimization:How to optimize statements with greater than condition in

How to optimize statements with greater than condition in MySQL.Example:

Expand|Select|Wrap|Line Numbers
  3.     PD.TEMP_VAR2
  4. FROM
  5.     db_sub_warehouse_b pdb
  6.     JOIN db_sub_warehouse pd ON pdb.subwarehouse_id = pd.subwarehouse_id
  7.     JOIN pd_reportex_b prb ON prb.iccid >= rtrim( pdb.temp_var1 ) 
  8.     AND prb.iccid <= rtrim( pdb.temp_var2 )'
  9. WHERE
  10.     1 = 1 
  11.     AND pd.billcode = 'SW201904160006'
Nov 20 '19 #1
1 5560
3 2Bits
without database object information, the suggestions by PawSQL are:

CREATE INDEX PAW_IDX1360881332 ON db_sub_warehouse(billcode,subwarehouse_id,TEMP_VAR 2);
CREATE INDEX PAW_IDX1921682121 ON db_sub_warehouse_b(subwarehouse_id,temp_var1,temp_ var2,PHONENUMBER);

you may get more accurate suggestions by supplying more information to the tool.
Dec 22 '22 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

4 posts views Thread by Tristan | last post: by
2 posts views Thread by amos_s12 | last post: by
24 posts views Thread by sureshjayaram | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.