3 ms·
Of course, a better choice now would be to use PostgreSQL's new JSON support. Postgres has also had XML document types for a long time, though I'm not sure of t
by tensor 13y ago
Of course, a better choice now would be to use PostgreSQL's new JSON support. Postgres has also had XML document types for a long time, though I'm not sure of their indexing story.
If you don't need indexing into the document, you can easily just store it as serialized bytea data. I've done this quite frequently and it works wonderfully.
- threeseed 13y agoSorry but PostgreSQL's JSON query syntax is insanely complicated compared to MongoDB. And that is a big deal for a lot of developers.
- tensor 13y agoI just took a look, and if I'm getting this right, it looks about as simple as it gets: SELECT json_data FROM people WHERE json_data->'age' > 15 vs db.people.find( { age: { $gt: 10 } } ) Personally, I prefer the postgres syntax. It's much clearer. I also don't buy your claims below about performance. Can you provide a real benchmark? Are you running with the safeties off meaning you lose data?
- dbcfd 13y agoWhat is the syntax on finding an array value matching some key? E.g. given a user with field "favFoods":[String], how do I determine that pizza is in there?
- jessedhillon 13y agoselect ... where "pizza" in person -> favFoods
- jessedhillon 13y agoSorry I'm stupid, I was thinking Python select ... where person -> favFood in ("pizza")
- gfodor 13y agoYour ORM will give you whatever syntax is natural, eventually.