1 |
On 03/30/2010 03:24 PM, Mirage ha wrote: |
2 |
> |
3 |
> Dear All, |
4 |
> |
5 |
> I do not know if this is the correct place to post this question or |
6 |
> not but as you have experience in embedded field i expected |
7 |
> you will help me. |
8 |
> |
9 |
> I facing a problem in choosing database engine for my application my |
10 |
> manager suggested to use files (e.g. txt files ) , i suggested to use |
11 |
> berkeley db. |
12 |
> So could you tell me which is better and if there is better solution ( |
13 |
> better db engine) please tell me. |
14 |
> also if there is link to good database benchmark comparison please |
15 |
> send it. |
16 |
> |
17 |
> Thank you, |
18 |
> M. |
19 |
|
20 |
Depending on the application, I might side with your manager, raw txt or |
21 |
binary files can be better in many situations. |
22 |
|
23 |
Depends a lot on the workload, explain the application in general. |
24 |
|
25 |
What is the most frequent operation a write, read( or search), or |
26 |
delete? Raw files, txt or binary write() it is very fast. Reading the |
27 |
file or seraching for something inside a large file can be slow without |
28 |
indexes, or the ability to binary search. If the data in the file is |
29 |
already sorted, for example by an incremeting ID, or time, binary |
30 |
search inside the file can be very fast. Appending data to the end of a |
31 |
file can be a O(1) operation. A DB engine after the write or delete, |
32 |
may have to update it's internal indexes, and rebalance its B-Tree, or |
33 |
update any other internal structures. |
34 |
|
35 |
|
36 |
How much data? How much I/O? |
37 |
|
38 |
Is program size important? writing to a file is much smaller program |
39 |
footprint than a DB engine. |
40 |
|
41 |
Optimizing for write or erase speed raw files will be faster. |
42 |
Optimizing for a fast search of data a DB engine will be faster unless |
43 |
you binary search your data in the files, or index it yourself. If |
44 |
your going through the trouble of using your own complex indexes, then |
45 |
you might as well use a DB engine to avoid re-inventing the wheel. |
46 |
|
47 |
-- |
48 |
Karl |