Taras Mitran: Leveraging PLV8 in Javascript heavy Web Applications

Web applications requiring real-time responsiveness and collaborative user interaction demand more client-side operations and business rules. Such code requires mirroring or similar server-side rules. PLV8, the Postgresql module for an embedded javascript engine allows code-reuse in a high performance setting, especially when applying and returning JSON from a normalized database design. In highly interactive web applications, increasingly larger sets of business rules and workflows are required to operate on the client-side in the browser. As expectations of desktop-quality applications on the web increase, such as Google Documents & Gmail, event-based decision making is requiring developers to utilize traditional design patterns such as Publish/Subscribe or model-view-controller designs as not purely server side. Code must often run similar procedures on both the desktop browser, mobile client and server for rules, document parsing, permissions, or validation. PLV8 is a an efficient solution for applying such code to database-driven applications. PLV8, a Postgresql module running Google's V8 javascript engine in the database, lets you run javascript code that was originally written for the browser. In one case study of its usage, a customer in the human resources analytics industry requested an application with a highly customized web interface for editing numerical tabular data. Business rules dictated certain user actions would recursively trigger additional events. For example, if a user wanted to apply a regression equation to the base salary of employees grouped by tiers of experience, it would update their total compensation values and check boundary condition validations. In such a "what if" scenario, the user expects their screen to be updated in real-time, like excel would perform. Therefore, the optimal solution was to perform the action on the client, then send just the regression formula and target field to the server asynchronously to perform the same logic in PLV8 to save the results to the Postgresql database.
Length: 20:09
Views 259 Likes: 0
Recorded on 2012-09-17 at Postgres Open
Look for other videos at Postgres Open.
Tweet this video