Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #62262 > unrolled thread

Re: Is it more CPU-efficient to read/write config file or read/write sqlite database?

Started byChris Angelico <rosuav@gmail.com>
First post2013-12-18 14:35 +1100
Last post2013-12-18 14:35 +1100
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Is it more CPU-efficient to read/write config file or read/write sqlite database? Chris Angelico <rosuav@gmail.com> - 2013-12-18 14:35 +1100

#62262 — Re: Is it more CPU-efficient to read/write config file or read/write sqlite database?

FromChris Angelico <rosuav@gmail.com>
Date2013-12-18 14:35 +1100
SubjectRe: Is it more CPU-efficient to read/write config file or read/write sqlite database?
Message-ID<mailman.4326.1387337755.18130.python-list@python.org>
On Wed, Dec 18, 2013 at 1:37 PM, Cameron Simpson <cs@zip.com.au> wrote:
>> I'd say this is the right thing for a DB to do.  If it comes back
>> from a commit() call, it better be on that disk, barring a failure
>> of the physical hardware.  If it comes back from a commit() and data
>> gets lost because of a power-failure, something is wrong.
>
> Depends on your view. People seem to treat dbs as some special form
> of data storage. I don't; to me they're no different to storing
> data in any other file. Do you do an fsync() every time you close
> a file you've written? Of course not, it is a gratuitous performance
> loss.  IMO, I've handed the data to the filesystem layer; its
> integrity is now the OS's problem.

An SQL database *is* a different form of storage. It's storing tabular
data, not a stream of bytes in a file. You're supposed to be able to
treat it as an efficient way to locate a particular tuple based on a
set of rules, not a different way to format a file on the disk. If you
want file semantics, use a file. Otherwise, what do you expect
commit() to do?

Also: the filesystem layer doesn't guarantee integrity. If you don't
fsync() or fdatasync() or some other equivalent [1], it's not on the
disk yet, so you can't trust it.

ChrisA

[1] See eg the PostgreSQL info on the subject:
http://www.postgresql.org/docs/9.3/static/runtime-config-wal.html#GUC-WAL-SYNC-METHOD

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web