mysql 查询速度一定要注意。

SQL 语句1
$sql="update “. G L O B A L S [ ′ e c s ′ ] − > t a b l e ( ′ o r d e r ′ ) . " s e t d i s c o u n t = 1 w h e r e a d d t i m e > GLOBALS['ecs']->table('order') ." set discount=1 where add_time> GLOBALS[ecs]>table(order)."setdiscount=1whereaddtime>stime and add_time<= e t i m e a n d i n v o i c e n o = etime and invoice_no= etimeandinvoiceno=id and pay_status=2”;
SQL 语句2
$sql="update “. G L O B A L S [ ′ e c s ′ ] − > t a b l e ( ′ o r d e r ′ ) . " s e t d i s c o u n t = 1 w h e r e a d d t i m e > ′ GLOBALS['ecs']->table('order') ." set discount=1 where add_time>' GLOBALS[ecs]>table(order)."setdiscount=1whereaddtime>stime’ and add_time<=‘ e t i m e ′ a n d i n v o i c e n o = ′ etime' and invoice_no=' etimeandinvoiceno=id’ and pay_status=2”;

只是条件多了一个 单引号,速度提升了N倍

你可能感兴趣的:(mysql 查询速度一定要注意。)