BETWEEN clause versus <= AND >=

前端 未结 8 1343
無奈伤痛
無奈伤痛 2020-12-14 05:54

Is there a performance difference between using a BETWEEN clause or using <= AND >= comparisons?

i.e. these two queries:

SELECT *  
  FROM table           


        
8条回答
  •  无人及你
    2020-12-14 06:35

    run1 "X>=Y AND X<=Z"

    run2 "X BETWEEN Y AND Z"

    I get one Plan hash value when I run explain plan twice. But Tom's runStats_pkg get diffent result:

    Run1 ran in 1 cpu hsecs
    Run2 ran in 1 cpu hsecs
    run 1 ran in 100% of the time
    
    Name                      Run1    Run2        Diff
    STAT...recursive calls          12      13       1
    STAT...CPU used by this sessio       2       3       1
    STAT...physical read total IO        0       1       1
    STAT...consistent gets          18      19       1
    ...
    ...
    LATCH.row cache objects         44,375   1,121     -43,254
    LATCH.cache buffers chains      68,814   1,397     -67,417
    STAT...logical read bytes from     655,360     573,440     -81,920
    STAT...session uga memory max      123,512       0    -123,512
    STAT...session pga memory      262,144  65,536    -196,608
    STAT...session pga memory max      262,144  65,536    -196,608
    STAT...session uga memory     -327,440  65,488     392,928
    
    Run1 latches total versus runs -- difference and pct
    Run1        Run2    Diff       Pct
    203,927      28,673    -175,254    711.22%
    

提交回复
热议问题