News for hackers. Stuff that matters.
Re:V8 Engine in PostgreSQL by y0ghur7_xxx on Friday February 24, 2012 @02:57PM (#3630724)
Most apps we write at work are boring data entry apps.

You have a form, you enter data, the data is somehow aggregated and presented to you in some other form or the data is sent off to some other service that then processes the data in some other way.

Removing a layer between the JS frontend and the DB just simplifies the whole stack: if postgres can do something like

   (select * from employees).to_json
and send it to the JS frontend that's already half of the app. The other half would be

   var record = {"empId": 2, "empName": "Franz"}
   insert into employees (emp_id, emp_name) values (record.empId, record.empName);

No java, .NET, ruby or python required. Plus it makes the sysOps happy: they have less stuff to handle.
Re:V8 Engine in PostgreSQL by route66 on Friday February 24, 2012 @04:57PM (#3631265)
If you wait for 9.2 you can say

    SELECT query_to_json('select x as b, x * 2 as c from generate_series(1,3) x',false);

http://people.planetpostgresql.org/andrew/index.php?/archive...

I can't find the link now, but the reverse (insert, update from json) I remember also to be possible.

Re:V8 Engine in PostgreSQL by ibejoeb on Friday February 24, 2012 @04:50PM (#3631238)
Re:V8 Engine in PostgreSQL by zbuc on Friday February 24, 2012 @07:02PM (#3631664)
What was the handwaving "send it to the JS frontend"?

Are you suggesting you allow the client-side JS app to call directly against the Postgres DB or is there another approach you had in mind?

Re:V8 Engine in PostgreSQL by einhverfr on Friday February 24, 2012 @08:57PM (#3631899)
I don't see how that differs from allowing a thick client written in wxPerl from directly connecting to the database. It seems quite useful in many cases.

One thing to keep in mind about PostgreSQL is you can do a lot of traditional middleware tasks (including message queues) in the database back-end with transactional control. These can even be hooked into other applications Remember, you can put a lot of what would otherwise go in a middleware layer in the database itself, especially with features in PostgreSQL like LISTEN/NOTIFY.

There are some limitations of this approach, but in general, I have found it ideal, but it requires thinking about your database differently. Instead of a data store on the bottom of the stack, you have an intelligent data storage and queuing system in the center of your environment.

Re:V8 Engine in PostgreSQL by cbsmith on Friday February 24, 2012 @11:48PM (#3632197)
One of the interesting changes in our reality, is the case for increasing scalability by having a middleware layer that does all the work has become quite weak. It's much cleaner to partition your systems and work that way.
Re:V8 Engine in PostgreSQL by einhverfr on Saturday February 25, 2012 @01:12AM (#3632316)
I don't think it's just that the performance case for middleware has become weak. It's also that traditionally you pay per connection some sort of license fee. So if you are running Oracle or SQL Server, and you want to add additional clients that, say, do additional process on notification, that means additional license fees. This isn't a problem on PostgreSQL.

It means there are choices between the traditional ones of putting everything in the database or in the middleware.

Re:V8 Engine in PostgreSQL by y0ghur7_xxx on Saturday February 25, 2012 @08:02AM (#3632848)
Are you suggesting you allow the client-side JS app to call directly against the Postgres DB or is there another approach you had in mind?

Almost directly. The JS frontend calls something like mod_libpq¹, or a very simple node.js "proxy". Something that just gets incoming http requests, executes stored procedures and sends back the response. A reverse proxy between the JS client and Postgres. That proxy can be very generic and reused between applications. All logic would live in the db.

¹http://asmith.id.au/mod_libpq.html