Skip to main content
On the backlog

Formal option for persisted computed columns

Related products:Software Factory
  • January 31, 2019
  • 9 replies
  • 268 views
  • Harm Horstman
    Harm Horstman
  • ElenaTodirenchi
    ElenaTodirenchi
  • TurcuPaulAndrei
  • DenisaViulet
    DenisaViulet

  • Warrior
  • 63 replies
Could we get an option to set the persisted flag on computed columns? To my understanding this should improve the performance of such columns (with more data usage as a trade-off). Is there any reason for this option to not be there yet?
Did this topic help you find an answer to your question?

9 replies

Anne Buit
Community Manager
Forum|alt.badge.img+5
  • Community Manager
  • 656 replies
  • February 1, 2019
Hi Pim, this can already be done by adding the keyword PERSISTED to the end of the calculated field query.



Keep in mind there are some limitations when using persisted computed columns, they must be deterministic.

Forum|alt.badge.img+3
  • Author
  • Warrior
  • 63 replies
  • February 1, 2019
Haha, that seems to be a solution, but I think you are basically saying we can use SQL injection in those fields. So I don't think this is the nicest possible way. And what will happen when in the future someone does decide to include a checkbox for the peristed flag (I still support this), will all calculated column expressions be updated then?

Anne Buit
Community Manager
Forum|alt.badge.img+5
  • Community Manager
  • 656 replies
  • February 1, 2019
A checkbox could be introduced to achieve this, yes. We could convert the existing PERSISTED keywords without too much effort.

However, as long as we do not need other parts of the Software Factory, IAM, Indicium or GUI's to make a distinction between persisted and non-persisted columns there's not much to gain.

Yes, there are no sanitizations done on the expressions you write here, so be careful ;)

I wouldn't go as far as to call it SQL injection as this is a setting configured during the development phase by a developer, not in a live environment by an end-user. None of these snippets ever be modifyable by an end-user so there's no risk there. Same counts for templates, SQL prefilters, validations etc.

Forum|alt.badge.img+3
  • Author
  • Warrior
  • 63 replies
  • February 1, 2019
I must say, those are some good arguments. I never really looked at it from a "does it add anything to our model" standpoint. My point about SQL injection might have been overstated, but allowing developers to go against the model using these fields might not be really great (although I must admit I don't see how you could deny them this without a SQL parser).

Robert Jan de Nie
Thinkwise blogger
Forum|alt.badge.img+6
Good to know, I was asked the same question today. Now I know the answer 🙂

Harold
Apprentice
Forum|alt.badge.img+1
  • Apprentice
  • 8 replies
  • November 16, 2023

I use the solution, suggested by Anne, quite often, but I still think the option to set persisted as an option is preferable as it is a property of the calculated column and not part of the calculation/expression itself. Upvote.


Arie V
Community Manager
Forum|alt.badge.img+12
  • Community Manager
  • 1068 replies
  • November 21, 2023

@Harold Totally agree that it would be good to add this to the Model as a setting. I was never aware of this option until you bumped this 4-year old topic...


Robert Jan de Nie
Thinkwise blogger
Forum|alt.badge.img+6

I agree with @Harold  and @Arie V that this should be a formal setting. I note down I learned this four years ago but had forgotten it in the meantime. A checkbox / formal setting would have lead to a situation you cannot forget and a more transparent way of solving this problem.


Mark Jongeling
Administrator
Forum|alt.badge.img+23
  • Administrator
  • 3959 replies
  • December 31, 2024
Open→On the backlog

Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings