sql-execution-plan

SQL Queries, execution plans and “Parallelism”

梦想的初衷 提交于 2021-02-18 10:41:10
问题 So I'm (still) going through some slow legacy sql views used to do calculate some averages and standarddeviations on a (sometimes) large set of data. What I end up with are views joining views joining views etc. So I though I would review the execution plan for my query. And it immediately suggested a missing index, which I then implemented. But it's still unbearably slow (so slow it times out the VB6 app querying it for data ;) ) So upon studying the execution plan further, I see that what

Using IN with a subquery doesn't use index

痞子三分冷 提交于 2021-02-07 10:51:49
问题 I have the fowlloing query select * from mapping_channel_fqdn_virtual_host where id in (1, 2, 3, 4, 5, 6, 7, 8, 9, 10); explaining the above query gives me the following result: explain select * from mapping_channel_fqdn_virtual_host where id in (1, 2, 3, 4, 5, 6, 7, 8, 9, 10); +----+-------------+-----------------------------------+------------+-------+---------------+---------+---------+------+------+----------+-------------+ | id | select_type | table | partitions | type | possible_keys |

Query cost relative to batch is 100%

℡╲_俬逩灬. 提交于 2021-01-26 03:13:36
问题 I'm not sure sure how to interpret this, but all the queries I run in sql server 2005 have a "query cost (relative to batch)" of 100%. Is there any way to reduce the cost? 回答1: If your batch (what you are executing within a given call) has one query then relative to that batch that query takes up 100% as it is the only query within that batch. I.e.: BEGIN SELECT * FROM table -- Will be 100% of batch END BEGIN SELECT * FROM table -- Will be 50% of batch SELECT * FROM table -- Will be 50% of

How to find out what is represented by the intermediate value used in SQL Server execution plan

旧巷老猫 提交于 2021-01-21 09:32:31
问题 I'm learning how to read the actual execution plan in SQL Server. I have noticed that SQL Server tends to represent intermediate value used in the physical query plan as e.g. expr1006 , expr1007 etc. (i.e. expr followed by a number). Here is a screenshot. Notice near the bottom, the expressions expr1006, expr1008, expr1009 listed in the section output list . It it possible to find out what they really represent? 回答1: Right click the compute scalar and choose "properties". Look in the "Defined

How to find out what is represented by the intermediate value used in SQL Server execution plan

霸气de小男生 提交于 2021-01-21 09:32:06
问题 I'm learning how to read the actual execution plan in SQL Server. I have noticed that SQL Server tends to represent intermediate value used in the physical query plan as e.g. expr1006 , expr1007 etc. (i.e. expr followed by a number). Here is a screenshot. Notice near the bottom, the expressions expr1006, expr1008, expr1009 listed in the section output list . It it possible to find out what they really represent? 回答1: Right click the compute scalar and choose "properties". Look in the "Defined

Spark: Extract dataframe from logical plan

雨燕双飞 提交于 2021-01-03 06:29:44
问题 This line of code converts a dataFrame to a logical plan val logical = df.queryExecution.logical Can we do the opposite, meaning extracting from the logical plan, the dataframes used ? 回答1: in Dataset object there is a method: def ofRows(sparkSession: SparkSession, logicalPlan: LogicalPlan) so if you have a logical plan, you can transform it into a DataFrame by calling Dataset.ofRows(sparkSession, logical) 来源: https://stackoverflow.com/questions/43763246/spark-extract-dataframe-from-logical

Spark: Extract dataframe from logical plan

∥☆過路亽.° 提交于 2021-01-03 06:29:07
问题 This line of code converts a dataFrame to a logical plan val logical = df.queryExecution.logical Can we do the opposite, meaning extracting from the logical plan, the dataframes used ? 回答1: in Dataset object there is a method: def ofRows(sparkSession: SparkSession, logicalPlan: LogicalPlan) so if you have a logical plan, you can transform it into a DataFrame by calling Dataset.ofRows(sparkSession, logical) 来源: https://stackoverflow.com/questions/43763246/spark-extract-dataframe-from-logical

Hive explain plan understanding

丶灬走出姿态 提交于 2020-06-21 10:31:13
问题 Is there any proper resource from where we can understand explain plan generated by hive completely? I have tried searching it in the wiki but could not find a complete guide to understand it. Here is the wiki which briefly explains how explain plan works. But I need further information on how to infer the explain plan. https://cwiki.apache.org/confluence/display/Hive/LanguageManual+Explain 回答1: I will try to explain a litte what I know. The execution plan is a description of the tasks