Formal option for persisted computed columns

Related products: Software Factory

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?
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.
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.
Good to know, I was asked the same question today. Now I know the answer 🙂
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?
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).

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.


@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...


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.