Is this SQL databases or No-SQL?
Is this SQL databases or No-SQL?
Posted Mar 28, 2014 11:55 UTC (Fri) by intgr (subscriber, #39733)In reply to: Is this SQL databases or No-SQL? by Wol
Parent article: A discussion between database and kernel developers
> You haven't told me what PostgreSQL actually does. Reading between the lines, it seems that every column is stored separately
I tried, but failed. No, all the fields in a single row are stored together. The difference from Pick is that there are no field terminators. Instead, variable-length fields are prefixed with their length. If it's not the column you're looking for, the database reads the length value of the field and skips that number of bytes to find the next column. Fixed-length fields like integer/float/date/etc, do not need to be prefixed with their length since their offset is known just by their data type.
> > And it also paints the database into a corner such that it cannot change the storage format easily.
> Or is that not what you meant?
What I meant is, if the database software exposes its on-disk format directly to the clients, then it cannot easily change the format in future versions. They may want to change the format for efficiency or other considerations. Of course as always, it has its advantages, such as fewer transformations needed before sending it to client.
> Certainly for older RDBMSs, adding a new column was a painful process
Adding a column that defaults to NULL (i.e. no value) is quick PostgreSQL and many other databases too.
> Because internally to the database, a row is just one big string.
You can call any piece of data "just a string". That doesn't give you any insight about how it's accessed.
> And it is the same technique as used by SQLite, too, so I understand
SQLite uses length-prefixed fields too, not terminator bytes.
