3 ms·
Just storing JSON in a database is not good enough, you need to be able to aggregate and index that data. I find XML an easier example of why it's important th
by buro9 17y ago
Just storing JSON in a database is not good enough, you need to be able to aggregate and index that data.
I find XML an easier example of why it's important that the database treats a semi-stuctured store as a first class entity, let's compare Oracle and SQL Server:
SQL Server:
http://msdn.microsoft.com/en-us/library/ms189887%28SQL.105%29.aspx http://msdn.microsoft.com/en-us/library/ms189887%28SQL.105%2...
Oracle:
http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14259/xdb04cre.htm http://download.oracle.com/docs/cd/B19306_01/appdev.102/b142...
MS SQL Server:
"Note the following general limitations that apply to the xml data type:
* The stored representation of xml data type instances cannot exceed 2 GB.
* It cannot be used as a subtype of a sql_variant instance.
* It does not support casting or converting to either text or ntext. Use varchar(max) or nvarchar(max) instead.
* It cannot be compared or sorted. This means an xml data type cannot be used in a GROUP BY statement.
* It cannot be used as a parameter to any scalar, built-in functions other than ISNULL, COALESCE, and DATALENGTH.
* It cannot be used as a key column in an index. However, it can be included as data in a clustered index or explicitly added to a nonclustered index by using the INCLUDE keyword when the nonclustered index is created."
Ok, so that's a pretty constraining set of restrictions. Just look at the lack of grouping, sorting, built-in function support.
And Oracle? Well it does all of that and allows for partial updates (update one Xml node or attribute and not the whole document). Oh, and Oracle fully implements XQuery too.
The difference between just storing something in a database and having the database understand and treat that something as a first class entity is massive.
I've used Xml as an example because it's well documented and understood, but the example extends to JSON/BSON easily enough.