Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #62262
| References | <20131215180754.404b0abc@bigbox.christie.dr> <20131218023701.GA54061@cskk.homeip.net> |
|---|---|
| Date | 2013-12-18 14:35 +1100 |
| Subject | Re: Is it more CPU-efficient to read/write config file or read/write sqlite database? |
| From | Chris Angelico <rosuav@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.4326.1387337755.18130.python-list@python.org> (permalink) |
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
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
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
csiph-web