Having views in DB vs Data manipulation in Expression rules - What approach is best in terms of Performance?

Certified Lead Developer
Consider simple scenario: I have joining date of an employee in DB, want to find out experience. We can achieve in two ways : 1. Writing a view with DB specific functions to find the date difference 2. Manipulating in Expression rules using Appian functions.
Which approach is best practice/improves performance? and strictly speaking When to go for DB views?
Any suggestions?..

OriginalPostID-241280

  Discussion posts and replies are publicly visible

  • DB views can help prepare the data for easy consumption in Appian.

    It is better to push data intensive processing to DB; then consume it from Appian.
  • 0
    Certified Lead Developer
    I'd typically use views when joining data from multiple tables or when there's a lot of manipulation required. Not convinced a view is necessary in the example you've given
  • So far the only time we've had to create a view is when joining multiple tables. The scenario above doesn't sound like it would necessarily warrant a view. I would create an expression to calculate the desired value and use the apply function to generate the column of data.
  • As per my understanding, If any business rule which required user interaction for evaluation and use other constants/rules value for evaluation then use expressions. However, bussines logic is kind of permanent rule, need data from other tables for manipulation or involve complex evaluation to convert user data into useful information use DB store procedure. DB views are only required when you want to display data from many table in single place form or appian.
  • @Ramanjaneyulu ..
    Hi

    As said above .. for the simple scenario which you have mentioned a view might not be required

    Afaik , in my opinion

    Using a view would be helpful when you don't want all columns but instead want only some columns data from many tables and need to show them in as single entity.

    In that case i feel that instead of using expression language using a view would be better as it reduces load on the system and can acheived quite easily and effectively in the back-end itself.

    Please correct me if im wrong
  • 0
    Certified Lead Developer
    Thanks all.
    @Shashank, normally if we need the data from multiple tables we create a view and get refer they view.
    If we need the data from single table with limited columns we can use queryentity().
    If at all manipulation required on data from single table, same we can do at Appian once we get it from DB.Here we need to consider performance as well .
    If I am not wrong creating a view without a specific business need , requires to create the view again at DB while moving the application different environment.
  • For moving applications with views to different environments, we break our application into smaller applications. The first app contains CDTs, data stores (without views), process models to build views, and groups. Once that application is imported, data stores published, and views created, then we import an application or patch containing a data store with the views. Then we import the rest of the application.