2 ms·
Manage as in write all the code that ensures adherence to the schema. If you say that the field called "score" is an int in a schema-ful DB, then insert an arra
by IgorPartola 12y ago
Manage as in write all the code that ensures adherence to the schema. If you say that the field called "score" is an int in a schema-ful DB, then insert an array, the DB will throw an error. If you do that in a schema-less DB, it will not unless you add a check yourself. If you are not using some type of unified DB access layer, you must perform this check every time you write a value. You must also perform the check every time you read a value, since someone else might have written something different to the DB while you weren't looking. This you take on doing much more work, yet gain flexibility and possibly some space savings (as in, you are not storing empty cells if you don't want to).
- zrail 12y ago(solely toward your final point) Many RDBMS' will optimize that for you. PostgreSQL has a bitmap structure on each row that indicates which columns are null and which have data in them. In addition, it automatically compresses certain data types. For example, strings that overflow to the point where they need to be stored in a secondary table (called "toast" in pg) will be automatically compressed.
- IgorPartola 12y agoThat's pretty cool. I didn't know Postgres actually did this, though I figured it was at least possible.
- jrochkind1 12y ago> Manage as in write all the code that ensures adherence to the schema... ...This you take on doing much more work, yet gain flexibility The flexibility you gain seems to mostly be... the flexibility to choose not to ensure adherence to the schema. Which may be a valid choice in some cases, but I suspect a lot of people don't quite realize they are making it let alone analyze whether it is the right choice for them, and come to regret it.
- IgorPartola 12y agoWhich is pretty much my point. Most people don't realize the hidden cost here. It's the same reason you wouldn't use a dict for everything in Python.
- collyw 12y agoYou are unlikely to gain space savings, as it stores the keys as well as the values to all records.