Am Samstag, 28. Februar 2004 04:22 schrieb Timwi:
Ivo Köthnig wrote:
Using a
database allows us to run a set of highly complex queries to
examine the relationships between articles and the metadata about
articles. In fact we can even examine the relationship between articles
and users (watchlist), or between the metadata of different articles
(redirect status in "What links here").
This also can be done without a database. Of course in that case you have
to implement the needet datastructure and can not use sql-queries. This
takes more time to develop, but you are free to code whatever
datastructure you might think is the best. The try to emulate it by a
db-structure can fail and even if you it does not fail you are slower
since you have all the overhead-calculations the database produce since
it wants to be as generell as possible.
You have not provided examples of "overhead calculations" that a DB
would have to perform that a file system wouldn't. You also haven't
provided evidence of your claim that DBMSs cannot represent the required
range of data structures.
That starts with parsing and transforming a sql-statement into an expression
of relational algebra (which can not always produce the optimal (fastets)
expression) and ends by the point that you are restricted to these
expressions which can be handeled only step by step (operation always on the
huge table).
There is a huge number of organisatorial tasks that
you would need to do
with your files (when reading, that would be parsing the file, locating
data, possibly caching and perhaps sorting; when writing, that would be
updating indexes, managing "holes" in the file, and a huge host of other
that is no problem if you use good datastructures...
horrendous things). Next, if your data structures are
spread over
several files, you will have huge problems implementing atomicity, and
you will run into a number of race conditions.
That is a good point and one of the points I wanted to hear from you to
convince me.
DBMSs are specifically designed to do exactly these
things. People often
tend to forget that DBMSs aren't really much more than systems that
manage files! But they have all these incredibly complicated and
advanced things in it that you need and you really really don't want to
have to re-implement from scratch.
Yes, but you don't want to implement each of that features.
For 99.9% of data you want to store, you *can* create
*exactly* the data
structure you need using an RDBMS.
By data structure I am not only mean the structure of data. I also mean the
code which belongs to it to handle it (For example heaps, sorted lists and so
on). The structure for the data surly can be created but not the code...
But yes: Indexing and sorting is something the dbms (hopefully) can handle
perfectly... (But on the other hand sorting and indexing can be implemented
very easy)
It is a fallacy that a database makes things more
complicated. It makes
I dont say this. It makes coding easier. But easy code is always slow...
It is pretty bold to think that you can do so much better (i.e. faster)
than the hundreds of thousands of experienced developers who have put
their effort into MySQL.
The reason ist not that I can code much better (and I never told this). The
argument was that we (may) don't need this general piece of software. Of
course hundreds of thousands of experienced developers who have put
their effort into MySQL can implement a better MySQL. But we also don't use M$
Windows just because hundreds of thousands of (may or may not) experienced
developers coded there some functions we may could use.
I really just asked why we use it and what the advantages are. You pointed out
a good point (atomicity). That is something I would accept. Thats a point
that makes sence for me.
--Ivo Köthnig