From 94c5638c2197afc61e39774484da972704f0517f Mon Sep 17 00:00:00 2001 From: NataliaIvakina <82437520+NataliaIvakina@users.noreply.github.com> Date: Mon, 24 Jun 2024 14:51:19 +0200 Subject: [PATCH] Add GQLstatus to `DynamicProperty` and `CodeGenerationFailed` (#149) Co-authored-by: Louise Berglund --- .../notifications/all-notifications.adoc | 146 ++++++++++++++++-- 1 file changed, 136 insertions(+), 10 deletions(-) diff --git a/modules/ROOT/pages/notifications/all-notifications.adoc b/modules/ROOT/pages/notifications/all-notifications.adoc index c8a4714..61b5c10 100644 --- a/modules/ROOT/pages/notifications/all-notifications.adoc +++ b/modules/ROOT/pages/notifications/all-notifications.adoc @@ -553,7 +553,13 @@ RETURN line [#_neo_clientnotification_statement_dynamicproperty] === DynamicProperty -.Notification details +==== Notification details + +[.tabbed-example] +===== +[.include-with-neo4j-code] +====== + [cols="<1s,<4"] |=== |Neo4j code @@ -566,8 +572,35 @@ m|INFORMATION m|PERFORMANCE |=== -.Using a dynamic node property key makes it impossible to use indexes -==== +====== +[.include-with-GQLSTATUS-code] +====== + +[cols="<1s,<4"] +|=== +|GQLSTATUS code +m|03N95 +|StatusDescription +a|info: dynamic property. +An index exists on label/type(s) `$label_list`. +It is not possible to use indexes for dynamic properties. +Consider using static properties. +|Severity +m|INFORMATION +|Classification +m|PERFORMANCE +|=== + +====== +===== + + +==== Example of when using a dynamic node property key makes it impossible to use indexes + +[.tabbed-example] +===== +[.include-with-neo4j-code] +====== Query:: + @@ -588,10 +621,47 @@ For example, if `prop` is equal to `name`, the following query would be able to ---- MATCH (n:Person) WHERE n.name IS NOT NULL RETURN n; ---- -==== -.Using dynamic relationship property key makes it impossible to use indexes -==== +====== +[.include-with-GQLSTATUS-code] +====== + +Query:: ++ +[source, cypher] +---- +MATCH (n:Person) WHERE n[$prop] IS NOT NULL RETURN n; +---- + +Returned GQLSTATUS code:: +03N95 + +Returned Status Description:: +info: dynamic property. +An index exists on label/type(s) `Person`. +It is not possible to use indexes for dynamic properties. +Consider using static properties. + +Suggestions for improvement:: +If there is an index for `(n:Person) ON (n.name)`, it will not be used for the above query because the query is using a dynamic property. +Therefore, if there is an index, it is better to use the constant value. +For example, if `prop` is equal to `name`, the following query would be able to use the index: ++ +[source, cypher] +---- +MATCH (n:Person) WHERE n.name IS NOT NULL RETURN n; +---- + +====== +===== + +==== Example of when using a dynamic relationship property key makes it impossible to use indexes + +[.tabbed-example] +===== +[.include-with-neo4j-code] +====== + Query:: + [source,cypher] @@ -611,12 +681,51 @@ For example, if `$prop` is equal to `since`, you can rewrite the query to: MATCH ()-[r: KNOWS]->() WHERE r.since IS NOT NULL RETURN r ---- -==== +====== +[.include-with-GQLSTATUS-code] +====== + +Query:: ++ +[source,cypher] +---- +MATCH ()-[r: KNOWS]->() WHERE r[$prop] IS NOT NULL RETURN r +---- + +Returned GQLSTATUS code:: +03N95 + +Returned Status Description:: +info: dynamic property. +An index exists on label/type(s) `KNOWS`. +It is not possible to use indexes for dynamic properties. +Consider using static properties. + +Suggestions for improvement:: +Similar to dynamic node properties, use a constant value if possible, especially when there is an index on the relationship property. +For example, if `$prop` is equal to `since`, you can rewrite the query to: ++ +[source, cypher] +---- +MATCH ()-[r: KNOWS]->() WHERE r.since IS NOT NULL RETURN r +---- + +====== +===== [#_neo_clientnotification_statement_codegenerationfailed] === CodeGenerationFailed -.Notification details +The `CodeGenerationFailed` notification is created when it is not possible to generate a code for a query, for example, when the query is too big. +For more information about the specific query, see the stack trace in the _debug.log_ file. + +==== Notification details + +[.tabbed-example] +===== +[.include-with-neo4j-code] +====== + [cols="<1s,<4"] |=== |Neo4j code @@ -629,8 +738,25 @@ m|INFORMATION m|PERFORMANCE |=== -The `CodeGenerationFailed` notification is created when it is not possible to generate a code for a query, for example, when the query is too big. -To find more information about the specific query, see the stack trace in the _debug.log_ file. +====== +[.include-with-GQLSTATUS-code] +====== + +[cols="<1s,<4"] +|=== +|GQLSTATUS code +m|01N40 +|StatusDescription +a|warn: runtime unsupported. +The query cannot be executed with `preparser_input1`, `preparser_input2` is used. Cause: `$msg`. +|Severity +m|INFORMATION +|Classification +m|PERFORMANCE +|=== + +====== +===== [#_hint_notifications] == `HINT` category