Skip to Main Content


Question and Answer

Connor McDonald

Thanks for the question, yang.

Asked: March 14, 2023 - 12:54 am UTC

Last updated: March 14, 2023 - 1:50 am UTC

Version: 19.3c

Viewed 100+ times

You Asked

Hi tom, Does Oracle use os cache? Below is my test.

1. power on Linux and then startup oracle
run a sql cost about 60s.

2. then shutdown oracle and startup up oracle again
run same sql cost about 3s.

3. then shutdown oracle and use "echo 3 > /proc/sys/vm/drop_caches " to clearup cache, then startup up oracle again.
run same sql cost about 60s.

I saw this three times sql execution plan is the same. I know the reason why the first time to exec this sql cost too much time, Because database need read data from disk. But I shutdown oracle and startup up oracle again, Oracle should be free up the SGA which include data buffer cache, why does the second time exec the sql is so fast? Does it use the os cache which not free after oracle shutdown?

and Connor said...

This depends on the parameter filesystemio_options

FILESYSTEMIO_OPTIONS = { none | setall | directIO | asynch }

You can choose whether you want direct I/O (ie, we do not use OS cache, so you would typically increase the buffer cache to let it do all the cache handling). If you do not use direct I/O, then we just send file requests to the OS in the normal way and it decides on caching.

Typically direct I/O (if the OS and file system you are using support it) is the best way to go, because the database knows best what is valuable to cache, and what is not worth it. For example, no benefit in caching a redo log because we're only going to write to it and never read it (in normal operations)

More to Explore


Need more information on Administration? Check out the Administrators guide for the Oracle Database