News for hackers. Stuff that matters.
Re:Let Postgres Do the Work (2013) by Klathmon on Saturday November 26, 2016 @07:59PM (#13047053)
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.

Re:Let Postgres Do the Work (2013) by mozumder on Saturday November 26, 2016 @08:31PM (#13047192)
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.

Re:Let Postgres Do the Work (2013) by icebraining on Sunday November 27, 2016 @05:08AM (#13048533)
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?
Re:Let Postgres Do the Work (2013) by mixedCase on Sunday November 27, 2016 @05:47AM (#13048621)
http://postgrest.com/

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

Re:Let Postgres Do the Work (2013) by icebraining on Sunday November 27, 2016 @07:33AM (#13048830)
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.
Re:Let Postgres Do the Work (2013) by mixedCase on Sunday November 27, 2016 @08:47AM (#13049083)
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.
Re:Let Postgres Do the Work (2013) by keshab on Saturday November 26, 2016 @11:20PM (#13047695)
Because it is easier to maintain Python code rather than SQL.