Re: Tree ADT vs Database
- From: Missaka Wijekoon <mwijekoon@xxxxxxxxxxx>
- Date: Sat, 08 Apr 2006 10:51:42 -0700
djcredo@xxxxxxxxx wrote:
Hi all,Matt,
I have an application that currently works with two very large n-ary
trees. A lot of time is spent doing depth-first searches on these
trees.
I'm thinking of moving away from using trees to using a database
backend, and using SQL to query the database. Would I get any
performance improvement this way? What sort of datastructure does a
database use? What sort of Big-Oh times would I be likely to get?
Thanks in advance!
Matt
As many of the posters have told you, whether a database using SQL is faster (or better) is dependent on how you plan to use and access that data. I have written memory based trees for speed and used SQL for longer term storage, etc.
Remember, that in order to "talk" to a database the db library has to transfer and parse/unparse SQL back and forth. In addition, there may be IPC, network and/or i/o latencies in communicating with a relational database like BD2 or MySQL. The extra overhead involved in doing SQL may be more time consuming than direct memory accesses involved in your own tree.
How many nodes are you keeping in memory? How big is a node? Is it read much more often than it is updated? Does it need to be persistant? How many nodes per second does your application access?
From my own personal experience, a relational database is slower than even a slow memory based tree. Also, normalization helps to compress the data. In accessing the data, the time required to de-normalize the data may require more time.
-Misk
.
- References:
- Tree ADT vs Database
- From: djcredo
- Tree ADT vs Database
- Prev by Date: Xterm embedded in Eclipse
- Next by Date: Re: noobie needs help
- Previous by thread: Re: Tree ADT vs Database
- Next by thread: Ideas on "Auto-update"
- Index(es):
Relevant Pages
|