My query runs faster the second time around, how do i stop that?

后端 未结 4 2066
北海茫月
北海茫月 2021-02-19 22:55

i am running a query in oracle 10 select A from B where C = D B has millions of records and there is no index on C

The first time i run it it takes about 30

4条回答
  •  故里飘歌
    2021-02-19 23:18

    The obvious answer is for each test case to run the query multiple times, and throw out the first result.

    Its not easy to completely replicate the conditions of the first query run, because of the various caches involved: some are Oracle caches (cursor, buffer, etc.); some are OS (disk cache, depending on Oracle config); some are hardware (SAN, RAID, disk).

    Rebooting the database server before each trial will probably come pretty close to consistent conditions.

提交回复
热议问题