Wednesday, 15 February 2012

sql - Writing small data to file and reading from it or query the database -



sql - Writing small data to file and reading from it or query the database -

i have situation have query database info same users , changes daily, figured create file in save info (once per day) , load file each time user visits site.

now, know mutual practice (caching) when requests database big info i'm write file simple 3 digit number, question should still faster or overkill , should stick database query?

caching, when done right, faster.

it depends how long storing , retrieving info file takes , how long requests database takes.

if database query number takes long, caching may idea, since info small.

if search (e.g. sequential) in file lots of cached info (which doesn't seem case), take long.

disk i/o slower database i/o (which unlikely, unless it's local db).

bottom line - benchmark.

for scenario, caching idea, if it's single 3-digit number users i'd seek stick in ram rather in file.

sql database performance file-io

No comments:

Post a Comment