Forum: Ruby on Rails offtopic: which one is faster: file or database?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Onur T. (Guest)
on 2005-12-25 17:51
(Received via mailing list)
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
Craig W. (Guest)
on 2005-12-25 18:45
(Received via mailing list)
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
Onur T. (Guest)
on 2005-12-25 19:28
(Received via mailing list)
thanks craig.
This topic is locked and can not be replied to.