From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1Nwd6Q-00030d-2j for garchives@archives.gentoo.org; Tue, 30 Mar 2010 15:11:38 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id B0FF1E0DA5 for ; Tue, 30 Mar 2010 15:11:37 +0000 (UTC) Received: from homiemail-a27.g.dreamhost.com (caiajhbdccah.dreamhost.com [208.97.132.207]) by pigeon.gentoo.org (Postfix) with ESMTP id 334C5E0983 for ; Tue, 30 Mar 2010 15:01:29 +0000 (UTC) Received: from [192.168.67.100] (unknown [83.39.224.108]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by homiemail-a27.g.dreamhost.com (Postfix) with ESMTPSA id 257B259807E for ; Tue, 30 Mar 2010 08:01:27 -0700 (PDT) Message-ID: <4BB21245.6000209@hiramoto.org> Date: Tue, 30 Mar 2010 17:01:25 +0200 From: Karl Hiramoto User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.8) Gecko/20100323 Thunderbird/3.0.3 Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-embedded@lists.gentoo.org Reply-to: gentoo-embedded@lists.gentoo.org MIME-Version: 1.0 To: gentoo-embedded@lists.gentoo.org Subject: Re: [gentoo-embedded] help in choosing DB engine for embedded application References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Archives-Salt: 1b502cd9-96b3-4282-b5dc-8a247349b0e1 X-Archives-Hash: bfa900c166363a6b1bc96ccc10cfbc2c On 03/30/2010 03:24 PM, Mirage ha wrote: > > Dear All, > > I do not know if this is the correct place to post this question or > not but as you have experience in embedded field i expected > you will help me. > > I facing a problem in choosing database engine for my application my > manager suggested to use files (e.g. txt files ) , i suggested to use > berkeley db. > So could you tell me which is better and if there is better solution ( > better db engine) please tell me. > also if there is link to good database benchmark comparison please > send it. > > Thank you, > M. Depending on the application, I might side with your manager, raw txt or binary files can be better in many situations. Depends a lot on the workload, explain the application in general. What is the most frequent operation a write, read( or search), or delete? Raw files, txt or binary write() it is very fast. Reading the file or seraching for something inside a large file can be slow without indexes, or the ability to binary search. If the data in the file is already sorted, for example by an incremeting ID, or time, binary search inside the file can be very fast. Appending data to the end of a file can be a O(1) operation. A DB engine after the write or delete, may have to update it's internal indexes, and rebalance its B-Tree, or update any other internal structures. How much data? How much I/O? Is program size important? writing to a file is much smaller program footprint than a DB engine. Optimizing for write or erase speed raw files will be faster. Optimizing for a fast search of data a DB engine will be faster unless you binary search your data in the files, or index it yourself. If your going through the trouble of using your own complex indexes, then you might as well use a DB engine to avoid re-inventing the wheel. -- Karl