Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.027 X-Spam-Evidence: '*H*': 0.95; '*S*': 0.00; 'postgresql': 0.07; 'subject:file': 0.07; '*is*': 0.09; 'storage.': 0.09; 'cc:addr :python-list': 0.11; 'filesystem': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'hardware.': 0.16; 'imo,': 0.16; 'simpson': 0.16; 'storing': 0.16; 'subject: \n ': 0.16; 'tuple': 0.16; 'wrote:': 0.18; 'do.': 0.18; 'wed,': 0.18; 'not,': 0.20; 'otherwise,': 0.22; 'cc:addr:python.org': 0.22; 'bytes': 0.24; 'file.': 0.24; 'cc:2**0': 0.24; "i've": 0.25; 'equivalent': 0.26; 'subject:/': 0.26; 'gets': 0.27; 'header:In-Reply-To:1': 0.27; '[1]': 0.29; "doesn't": 0.30; 'dec': 0.30; 'message- id:@mail.gmail.com': 0.30; 'layer': 0.31; 'view.': 0.31; 'file': 0.32; 'supposed': 0.32; "i'd": 0.34; "can't": 0.35; 'info': 0.35; 'problem.': 0.35; 'something': 0.35; 'received:google.com': 0.35; 'data,': 0.36; 'disk': 0.36; 'subject:?': 0.36; 'url:org': 0.36; 'performance': 0.37; 'depends': 0.38; 'pm,': 0.38; 'expect': 0.39; 'subject:': 0.39; 'lost': 0.61; 'url:3': 0.61; 'course': 0.61; "you're": 0.61; 'back': 0.62; "you've": 0.63; 'guarantee': 0.63; 'subject:more': 0.64; 'different': 0.65; 'close': 0.67; 'physical': 0.72; 'integrity': 0.74; 'special': 0.74; 'subject:read': 0.84; 'to:none': 0.92; '2013': 0.98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=WYk/D73lqYjwIQZYMBK5GGD1vQv+Gt0O+cv1TkoLn+c=; b=i1S+GiHoyFY6zBjgFiZtv8aq8a3CyxZaU34rSGbf35khETrtMqvOOVGmaCtH0poDuh mKwZfDFOUGM7MGxUM5ZUXwIMpDYzywQ7RHYSck+3JdMObMkugo2X4SpaK5gi1Z0pkuuj 3P9OdeMUVD+A3D1LvB0PDwF/s/E2/u9HthqJC8ybuvgHuPj4+/tHFuQSYgvDny1uYZfu BKkKsfOpvN0b1hGYVh0vEpuRXZw6pQklaXUBGjHahGYK8NC3l+F5YgcJ3kXMpz5pnhyN vOI8fmtbtw1xG8Jx/YABarAIIPQqWCvv9UxJNe/C/tacAmf6eeaeJzmj6SLrBIohnBAy EDDw== MIME-Version: 1.0 X-Received: by 10.66.65.134 with SMTP id x6mr31543201pas.142.1387337751969; Tue, 17 Dec 2013 19:35:51 -0800 (PST) In-Reply-To: <20131218023701.GA54061@cskk.homeip.net> References: <20131215180754.404b0abc@bigbox.christie.dr> <20131218023701.GA54061@cskk.homeip.net> Date: Wed, 18 Dec 2013 14:35:51 +1100 Subject: Re: Is it more CPU-efficient to read/write config file or read/write sqlite database? From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 28 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1387337755 news.xs4all.nl 2832 [2001:888:2000:d::a6]:34426 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:62262 On Wed, Dec 18, 2013 at 1:37 PM, Cameron Simpson 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