Offtopic: which one is faster: file or database?


#1

hi,
this topic is not directly about rails but I wanna hear your opinions
and
experience in this matter.

you know apache’s access.log … I am using lighttpd accesslog which is
same
as apache for some of my analysis. I copy the log into my database
during my
analysis for soem advanced queroies and then delete it. It’s done once a
day
on a non-loaded hour (5 am) so it doesnt bring in a problem of load.

one of my colleagues advised to turn off accesslog and log access
directly
to database, because it’ll be faster. can it be true? the accesslog just
appends a line to end of file, but database creates indexes etc. and at
the
end database also writes to several files. Can this statement be true?

thanks in advance.
onur


#2

On 25 Dec 2005, at 15:49, Onur T. wrote:

one of my colleagues advised to turn off accesslog and log access
directly to database, because it’ll be faster. can it be true? the
accesslog just appends a line to end of file, but database creates
indexes etc. and at the end database also writes to several files.
Can this statement be true?

Did you just ask if databases are faster to write to than flat files?

If so, the answer is, of course, “it depends.” Generally the answer
is yes. Most sane modern database backends will write to pages in
memory and so can do batched writes rather than line-by-line writes
as would be used in an accesslog, even if there are a few indexes.

Hope that helped.

Yours,
Craig

Craig W. | t: +44 (0)131 516 8595 | e: removed_email_address@domain.invalid
Xeriom.NET | f: +44 (0)709 287 1902 | w: http://xeriom.net


#3

thanks craig.