Re: AW: [PEAR-DEV] RE: Re: Sqlite wrapper for Log package
| From: | Bertrand Mansion | Date: | Mon, 05 Jan 2004 00:24:37 +0000 |
| Subject: | Re: AW: [PEAR-DEV] RE: Re: Sqlite wrapper for Log package | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-24752@lists.php.net to get a copy of this message | ||
<borz_off@cs.msu.su> wrote :
> Hi!
>
> Pierre-Alain Joye wrote:
>>> sqlite isn't so fast when it comes to concurrent writes, as the whole
>>> DB file has to be locked. I'm not sure if I'd use it for writing
>>> logfiles.
>>
>>
>> Indeed, but always better than other DBs
>
> Excuse me? No DB will lock the whole table for *insert*. Even MySQL won't..
>
>> and it's the same problem for file based logs.
>
> I remember reading that 'a' mode of fopen() was specifically designed to
> prevent
> these kinds of problems. Besides, you don't usually keep other data in log
> files, while you do keep it in SQLite "database" file.
Actually, sqlite works better with "small" databases. So it is recommended,
for example with a log db, to have it "splitted" into multiple smaller dbs.
For example, one per month or week, it depends on your log use.
Sqlite is able to attach those dbs later if you need to query more than one
db. This makes it very practical. In the case of logs, I wouldn't recommend
to keep other data in the db file.
About the lock created on concurrent writes, I haven't tested yet but I
would say it might not be noticeable as the write is done very quickly.
Bertrand Mansion
Mamasam