sponsored links

Collapse

Announcement

Collapse
No announcement yet.

SQL view calculated column

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • SQL view calculated column

    Hello everyone.

    I've got a question that I've been wondering about for a while, and have not been able to find the answer.

    So, I'm hoping someone here will know.

    Here is the scenario.

    I've got an SQL view, ViewABC, which has a calculated column (eg. calculating a duration between dates or times).

    This view, ViewABC, is then included as part of another SQL view, ViewXYZ, but the calculated column is not used in ViewXYZ.

    The question therefore is, does the calculated column from ViewABC still get calculated for each ViewABC row that is retrieved as part of a query against ViewXYZ?


    Thanks in advance.

    Walt

  • #2
    It does not. I created two views - 1 with a calculation against a table with 9 million records. The second view was built over the first but didn't include the column that was created by the calculation.

    I then created an RPG program that ran sequentially through each and the view1 took 91 seconds. The second took 44 seconds.

    Comment


    • #3
      Excellent!

      Thank you for taking the time to look into this Rocky!

      Walt

      Comment


      • #4
        Does anyone know if this works the same way when being processed by SQE/CQE engines?

        Walt

        Comment


        • #5
          There is very very little that runs through the old engie these days. Run the SQL through the performance advisor and you should be able to see for sure.

          Comment


          • #6
            Thanks Jon Boy!

            I will look into that.

            Walt

            Comment

            Working...
            X