On linux, caching is always to your advantage:
 When reading a sector on disk, the kernel copies the sector in ram,
in a cache, and then pass this information to the process that needs
to read it.  When writting, it automatically writes in ram and buffers
the write on disk for later (with sqlite, the buffer is cleared and
flushed to the disk after the transaction is commit).  So the sector
in kernel cache is, with sqlite, always the same as the one on the
disk.

Since this behavior is done by the kernel, any ways to change this
behavior will have to do with OS calls, kernel features and system
utilities... far from the scope of sqlite.

Simon

On Mon, Feb 23, 2009 at 4:58 AM, manohar s <manohar...@gmail.com> wrote:
> Thanks for your quick replies, although restarting my machine, disc cache is
> cleared, I am trying to find an utility which could do the job without
> requiring a restart.
>
> Regards,
> Manohar.S
>
> On Mon, Feb 23, 2009 at 1:47 PM, Dan <danielk1...@gmail.com> wrote:
>
>>
>> On Feb 23, 2009, at 2:44 PM, manohar s wrote:
>>
>> > Hi,
>> > I am doing some performance analysis on my SQLite queries. The
>> > problem is
>> > SQLite seems to be caching query results.
>> > I tried restarting my program, that is not helping. only if i don't
>> > access
>> > that database for 2 days then it is giving proper profile data.
>> > *
>> > Question*
>> > 1) How can I disable query result caching in SQLite?
>>
>> Assuming you are using SQLite directly, SQLite does not cache query
>> results. It does cache pages of the database file in memory to reduce
>> the amount of data loaded from the disk. This cache is just in regular
>> heap memory, so it is destroyed when the process using sqlite exits.
>>
>> Probably what you are seeing is that the OS caches recently accessed
>> file-system sectors. The first time you run the SQLite query data must
>> be loaded from the magnetic disk. The second and subsequent runs
>> retrieve data from the OS cache. Much faster.
>>
>> Dan.
>>
>>
>>
>>
>>
>> > Regards,
>> > Manohar.S
>> > _______________________________________________
>> > sqlite-users mailing list
>> > sqlite-users@sqlite.org
>> > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>>
>> _______________________________________________
>> sqlite-users mailing list
>> sqlite-users@sqlite.org
>> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>>
>
>
>
> --
> hope is the only thing which keeps us all happy
> http://sqlyog.wordpress.com/
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>



-- 
When Earth was the only inhabited planet in the Galaxy, it was a
primitive place, militarily speaking.  The only weapon they had ever
invented worth mentioning was a crude and inefficient nuclear-reaction
bomb for which they had not even developed the logical defense. -
Asimov
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to