Neat. I didn't know you could do anything like that with MySQL. Does Postgres have an equivalent? I wouldn't move from an SQL DB to a NoSQL key/value store without a significant performance improvement. Seems like you can tune MySQL far more than I realised...
Yes, InnoDB was standalone. But it had it's own SQL parser and things like Stored Procedures as well ;) It was rudimentary, but I don't know if KVS is the best description.
How MySQL and InnoDB talk is very much a K<->V / row based relationship.
There are a couple of comments on the original article that mention this:
PostgreSQL supports C-based UDF so it might not be impossible, but I'm not sure whether PostgreSQL has a standard/documented/safe way to access to internal data structures from UDFs.
…and…
Yoshinori-san, very interesting! We use a similar technique for our site together Postgresql. We have our own Software ODBA that writes SQL, marshals the data and puts the marshaled Data into the PGsql-DB. All of our data is always in the memory if the Application is running. ODBA is written in Ruby. You can find it here: http://scm.ywesee.com/?p=odba/.git;a=summary
It's called "Lessons Learned at Reddit", and mostly talks about building and deploying large-scale web applications (the technical, not business side of things.) Well worth watching (there's also a transcript.)
Comments
Neat. I didn't know you could do anything like that with MySQL. Does Postgres have an equivalent? I wouldn't move from an SQL DB to a NoSQL key/value store without a significant performance improvement. Seems like you can tune MySQL far more than I realised...
InnoDB was initially designed as a KVS. MySQL only added the SQL frontend to it.
Initially, MySQL also supported BerkeleyDB, another KVS, but as for now they dropped the support.
From InnoDB's point of view, MySQL is just a client, as is HandlerSocket the author is using.
PostgreSQL's storage engine is much more closely integrated into the system and has no low-level API easily available from the outside.
Yes, InnoDB was standalone. But it had it's own SQL parser and things like Stored Procedures as well ;) It was rudimentary, but I don't know if KVS is the best description.
How MySQL and InnoDB talk is very much a K<->V / row based relationship.
There are a couple of comments on the original article that mention this:
PostgreSQL supports C-based UDF so it might not be impossible, but I'm not sure whether PostgreSQL has a standard/documented/safe way to access to internal data structures from UDFs.
…and…
Yoshinori-san, very interesting! We use a similar technique for our site together Postgresql. We have our own Software ODBA that writes SQL, marshals the data and puts the marshaled Data into the PGsql-DB. All of our data is always in the memory if the Application is running. ODBA is written in Ruby. You can find it here: http://scm.ywesee.com/?p=odba/.git;a=summary
So maybe?
I don't know if they're using a particular feature, but Reddit is basically using Postgres as a KVS.
They said it was actually faster than other KVSes they tried. This was also a while ago.
I actually just looked up the video where they talk about this yesterday.
Here it is: http://thinkvitamin.com/code/steve-huffman-on-lessons-learne...
It's called "Lessons Learned at Reddit", and mostly talks about building and deploying large-scale web applications (the technical, not business side of things.) Well worth watching (there's also a transcript.)
The latest release of PosgreSQL includes hstore:
http://www.postgresql.org/docs/current/static/hstore.html
This is a single-value KVS within a field, not a replacement for SQL. You still need to write an SQL statement to access it.