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

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • PaSan
    New Member
    • Nov 2019
    • 1

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

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

    Code:
    SELECT
    	PDB.PHONENUMBER,
    	PD.TEMP_VAR2
    FROM
    	db_sub_warehouse_b pdb
    	JOIN db_sub_warehouse pd ON pdb.subwarehouse_id = pd.subwarehouse_id
    	JOIN pd_reportex_b prb ON prb.iccid >= rtrim( pdb.temp_var1 ) 
    	AND prb.iccid <= rtrim( pdb.temp_var2 )'
    WHERE
    	1 = 1 
    	AND pd.billcode = 'SW201904160006'
    Last edited by gits; Nov 20 '19, 08:47 AM. Reason: added code tags
  • Chandler
    New Member
    • Jul 2022
    • 3

    #2
    without database object information, the suggestions by PawSQL are:

    CREATE INDEX PAW_IDX13608813 32 ON db_sub_warehous e(billcode,subw arehouse_id,TEM P_VAR2);
    CREATE INDEX PAW_IDX19216821 21 ON db_sub_warehous e_b(subwarehous e_id,temp_var1, temp_var2,PHONE NUMBER);

    you may get more accurate suggestions by supplying more information to the tool.

    Comment

    Working...