Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Our application uses JSON throughout, and i've found the JSON functions in postgres to be invaluable!

I recently refactored several functions which kind of organically grew from several different functions each with it's own SQL query into one big query.

Not only did performance increase by a significant amount, the whole function is basically just "run this query and return the result" as the JSON functions in postgres allow me to leave the actual processing in the database and to not have to do the always annoying "loop over the 30,000 rows that were returned to build a JSON file" thing which is never fast.



JSON in Postgres is so fast... it's definitely not used widely enough.

I'm not even sure why people would use something like Django Rest Framework, when Postgres outputs JSON directly from a query.


Because they want a RESTful endpoint, not JSON-over-SQL. Would you open that up as a public API with free registration? How do you do access control using OAuth? How would you do stuff like convert images to thumbnails, extract text from PDFs or send an email?


http://postgrest.com/

Anything more complicated than that, and I'd recommend a simple Go application.


Both of those are adding a layer over Postgres; they are still "something like Django Rest Framework". Whether it's written in Python, Haskell or Go is not really the point I was making.


There's a lot of substance to the stack chosen. The performance Haskell or Go offer over Python let alone Django, a fat framework, make them far better picks for thin wrappers around an RDBMS.


Because it is easier to maintain Python code rather than SQL.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: