You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by GitBox <gi...@apache.org> on 2021/11/02 23:55:04 UTC

[GitHub] [ignite] Nikita-tech-writer opened a new pull request #9550: IGNITE-15134 Add documentation for SQL statistics functionality

Nikita-tech-writer opened a new pull request #9550:
URL: https://github.com/apache/ignite/pull/9550


   Thank you for submitting the pull request to the Apache Ignite.
   
   In order to streamline the review of the contribution 
   we ask you to ensure the following steps have been taken:
   
   ### The Contribution Checklist
   - [ ] There is a single JIRA ticket related to the pull request. 
   - [ ] The web-link to the pull request is attached to the JIRA ticket.
   - [ ] The JIRA ticket has the _Patch Available_ state.
   - [ ] The pull request body describes changes that have been made. 
   The description explains _WHAT_ and _WHY_ was made instead of _HOW_.
   - [ ] The pull request title is treated as the final commit message. 
   The following pattern must be used: `IGNITE-XXXX Change summary` where `XXXX` - number of JIRA issue.
   - [ ] A reviewer has been mentioned through the JIRA comments 
   (see [the Maintainers list](https://cwiki.apache.org/confluence/display/IGNITE/How+to+Contribute#HowtoContribute-ReviewProcessandMaintainers)) 
   - [ ] The pull request has been checked by the Teamcity Bot and 
   the `green visa` attached to the JIRA ticket (see [TC.Bot: Check PR](https://mtcga.gridgain.com/prs.html))
   
   ### Notes
   - [How to Contribute](https://cwiki.apache.org/confluence/display/IGNITE/How+to+Contribute)
   - [Coding abbreviation rules](https://cwiki.apache.org/confluence/display/IGNITE/Abbreviation+Rules)
   - [Coding Guidelines](https://cwiki.apache.org/confluence/display/IGNITE/Coding+Guidelines)
   - [Apache Ignite Teamcity Bot](https://cwiki.apache.org/confluence/display/IGNITE/Apache+Ignite+Teamcity+Bot)
   
   If you need any help, please email dev@ignite.apache.org or ask anу advice on http://asf.slack.com _#ignite_ channel.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] Berkof commented on a change in pull request #9550: IGNITE-15134 Add documentation for SQL statistics functionality

Posted by GitBox <gi...@apache.org>.
Berkof commented on a change in pull request #9550:
URL: https://github.com/apache/ignite/pull/9550#discussion_r744468654



##########
File path: docs/_docs/SQL/sql-statistics.adoc
##########
@@ -0,0 +1,182 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+= SQL Statistics
+
+== Overview
+
+Apache Ignite can calculate statistics by request and use it to build an optimal SQL query plan. This enables you to significantly speed up the SQL query execution.
+
+Without statistics, SQL query execution planner tries to guess about the query conditions selectivity using only general heuristics. To get better plans, make sure that statistics usage is link:tools/control-script#working-with-cluster-properties[enabled,window=_blank] and link:sql-reference/ddl#analyze[configure statistics collection,window=_blank] for tables participated in the query. See the link:SQL/sql-statistics#obtaining-a-better-execution-plan-using-statistics[example] for more details.
+
+Statistics are checked and updated each time after one of the following actions:
+
+* Node start
+* Topology change
+* Configuration change
+
+A node checks partitions and collects statistics for each of them, which can be used in SQL query optimization.
+
+== Configuring Statistics
+
+By default, statistics functionality is enabled.
+
+Statistics are stored locally, while statistics configuration parameters are stored cluster-wide.
+
+To enable or disable statistics in cluster use, execute the following command, specifying  `ON`, `OFF`,  or `NO_UPDATE` values:
+
+[tabs]
+--
+tab:Unix[]
+[source,shell]
+----
+control.sh --property set --name 'statistics.usage.state' --val 'ON'
+----
+tab:Windows[]
+[source,shell]
+----
+control.bat  --property set --name 'statistics.usage.state' --val 'ON'
+----
+--
+
+To see the statistics usage state, execute the command below:
+
+[tabs]
+--
+tab:Unix[]
+[source,shell]
+----
+control.sh --property get --name 'statistics.usage.state'
+----
+tab:Windows[]
+[source,shell]
+----
+control.bat --property get --name 'statistics.usage.state'
+----
+--
+
+For more details on configuring SQL statistics, see the link:monitoring-metrics/system-views[System Views,window=_blank] and link:sql-reference/ddl[Data Definition Language,window=_blank] pages.

Review comment:
       Better to open one of statistics views, like: /docs/monitoring-metrics/system-views#statistics_configuration and one of statistics related DDL commnds, like: /docs/sql-reference/ddl#analyze

##########
File path: docs/_docs/SQL/sql-statistics.adoc
##########
@@ -0,0 +1,182 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+= SQL Statistics
+
+== Overview
+
+Apache Ignite can calculate statistics by request and use it to build an optimal SQL query plan. This enables you to significantly speed up the SQL query execution.
+
+Without statistics, SQL query execution planner tries to guess about the query conditions selectivity using only general heuristics. To get better plans, make sure that statistics usage is link:tools/control-script#working-with-cluster-properties[enabled,window=_blank] and link:sql-reference/ddl#analyze[configure statistics collection,window=_blank] for tables participated in the query. See the link:SQL/sql-statistics#obtaining-a-better-execution-plan-using-statistics[example] for more details.
+
+Statistics are checked and updated each time after one of the following actions:
+
+* Node start
+* Topology change
+* Configuration change
+
+A node checks partitions and collects statistics for each of them, which can be used in SQL query optimization.
+
+== Configuring Statistics
+
+By default, statistics functionality is enabled.
+
+Statistics are stored locally, while statistics configuration parameters are stored cluster-wide.
+
+To enable or disable statistics in cluster use, execute the following command, specifying  `ON`, `OFF`,  or `NO_UPDATE` values:
+
+[tabs]
+--
+tab:Unix[]
+[source,shell]
+----
+control.sh --property set --name 'statistics.usage.state' --val 'ON'
+----
+tab:Windows[]
+[source,shell]
+----
+control.bat  --property set --name 'statistics.usage.state' --val 'ON'
+----
+--
+
+To see the statistics usage state, execute the command below:
+
+[tabs]
+--
+tab:Unix[]
+[source,shell]
+----
+control.sh --property get --name 'statistics.usage.state'
+----
+tab:Windows[]
+[source,shell]
+----
+control.bat --property get --name 'statistics.usage.state'
+----
+--
+
+For more details on configuring SQL statistics, see the link:monitoring-metrics/system-views[System Views,window=_blank] and link:sql-reference/ddl[Data Definition Language,window=_blank] pages.
+
+== Statistics Overriding
+
+Gathered values can be overridden by specifying additional parameters in the link:sql-reference/ddl#analyze[ANALYZE,window=_blank] command. The specified values override gathered one on each node in link:monitoring-metrics/system-views#statistics_local_data[STATISTICS_LOCAL_DATA,window=_blank], but not in link:monitoring-metrics/system-views#statistics_partition_data[STATISTICS_PARTITION_DATA,window=_blank]. Then, overriden values are used by SQL query optimizer.

Review comment:
       It's correct, that overriding affects statistics_local_data, but not statistics_partition_data. But it is not clear that SQL optimizer will use data from statistics_local_data and it can confuse newbie user if "overrides" changes SQL optimizer behaviour totally as real statistics or just partially. Can we make it more obvious?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] Nikita-tech-writer commented on pull request #9550: IGNITE-15134 Add documentation for SQL statistics functionality

Posted by GitBox <gi...@apache.org>.
Nikita-tech-writer commented on pull request #9550:
URL: https://github.com/apache/ignite/pull/9550#issuecomment-958566900


   @Berkof please review the PR.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] Nikita-tech-writer commented on pull request #9550: IGNITE-15134 Add documentation for SQL statistics functionality

Posted by GitBox <gi...@apache.org>.
Nikita-tech-writer commented on pull request #9550:
URL: https://github.com/apache/ignite/pull/9550#issuecomment-958566900


   @Berkof please review the PR.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] Nikita-tech-writer commented on pull request #9550: IGNITE-15134 Add documentation for SQL statistics functionality

Posted by GitBox <gi...@apache.org>.
Nikita-tech-writer commented on pull request #9550:
URL: https://github.com/apache/ignite/pull/9550#issuecomment-958566900


   @Berkof please review the PR.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org