-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Default collate ruins hana performance, seems like paging is broken #965
Comments
Let me please share some more evidence. Let's start with a simple SELECT: Cost is extremely low. Now let's add some order Now let's move further and support collations for the order: We can see that collation already makes cost 72 and it's explainable why - So imagine how huge the impact on the system is - just enabling collations - may literally eat the available database memory without any logical sense ( in case of key columns for example ). That's why I highly advice to reconsider usage of this option and leave it only for the cases when it's really needed by using one of CDS features:
@danjoa Please correct me if I don't understand something - but i find this problem now as a blocking factor for switching to a new driver unfortunately. Thanks! |
So I found the place which was causing the issue and enabling collation for every single string field.
is located in a file It seems to be a perfect place for a global feature flag check, however I'd like to suggest still to review the default logic:
The most important part - is that collations enabled by default are causing performance drop unfortunately, so they have to be used only there where is really needed |
Here is my workaround:
|
There are some product standards that have to be met by all SAP applications. One of them is the ability to provide internationalization. This includes localized sorting order of text fields. One of the most critical use cases that we have already tackled in Additionally all Additionally all There shouldn't be a need for a global collation disable flag as this would only be a work around for a more fundamental problem. As for disabling certain columns that currently already exists ( My current understanding of goal we have so far is to disable collation for |
Hi @BobdenOs thanks, for reply. Let me please iterate on your comments. Before this I'd like to highlight few things:
Additionally I'd like to iterate on following topics:
Indeed, that's true. But CAP apps written by clients, cannot be considered as SAP apps by default and internalization may be not required or even instead must be forbidden ( like in my company we only use English, regardless of users locale ).
I can't agree with this statement. Of course some fields may contain uuids, but there are many other cases when String field is not supposed to be human-readable, or is not a subject for localization ( like external id, numeric ids ( BELNR ) ) and it doesn't even make sense to collate them. Also talking about uuids, if it's unmanaged entity - we may use other keys rather than uuid, right? key is a key, doesn't matter what is a type
What about service-to-service communication? We're using CAP as REST API and it's not supposed to be called from UI directly. There is no locale in this case.
Sorting is OK, as what I mentioned before, main cost is caused by sort with COLLATE.
Correct! But what it means - if you we don't want to collate - then it means we have to annotate every single field. In large data models there may be thousands of columns - this is simply not possible just to annotate them that easily. What is your vision here? What if at some point we want to check things without collations - do we have to edit all the files and redeploy the app?
That is exactly what I'd like to achieve, yes. To have the ability to mention explicitly fields that they are localized. It would be nice also to support extended models, that's how we can mark existing columns as localized with extension views.
Right, but as I already mentioned before - we may use other columns to store different kinds of ids ( external ids, hashes, uuids in other formats, any other non-collatable strings which are technical )
Exactly! That would be much more transparent and predictable. |
Hi, Collation and localization are orthogonal features, and it wouldn't be correct to only treat localized strings as subjects for collation. Some non-localized strings are also valid candidates. In my opinion, it should be easy to opt out of generic collation and only enable it for some cases, knowing what impact it has on performance. Best regards, |
Thanks for confirming this @David-Kunz . That what I was also trying to figure out - it's a lot in documentation about localization but not much things mentioned about collations - so that's why I was not fully sure. Looking forward for updates this on this topic. As I already mentioned - the workaround is available - so it's not very urgent - but of course would be nice to have it working out of the box somehow. Cheers, |
Context
The problem
We expect that a query like
GET /odata/bkpf
should result in SQL like:however after switching to
@cap-js/hana
presented as a performance improver we've got a very serious issue, when table cannot even being read.So SQL now turned out into something like:
May be we need to activate something in the database but our HANA 2 SP7 just fails with OOM error now..
To my opinion this is simply not needed here. Therefore I'd like to bring here several points into discussion:
collate:false
it must becollate: true
only for fields when is needed. We don't have a large project but I guess we have already >10K columns in total. How do you imagine annotating every single string field with collate annotation?What do you think about this?
Can we make this module more configurable please?
As of now at least it would be great if we could sync with the docs and support
ignoreLocale
in JS too.Thanks!
The text was updated successfully, but these errors were encountered: