简体   繁体   English

分区对以下查询“从表名中选择*”有什么影响?

[英]What is the effect of partition on below query “Select * from Table_name”

I have implemented database partitioning on my database. 我已经在数据库上实现了数据库分区。 The partitioning is done by DBMS_REDEFINITION. 分区由DBMS_REDEFINITION完成。 The question in my mind is when we execute the select * statement from the table does the partitioning affect the performance. 我心中的问题是,当我们从表中执行select *语句时,分区是否会影响性能。

Tip: We are selecting entire data of a table 提示:我们正在选择表格的整个数据

What is the difference between select * from Non_Partitioned_table and select * from Partitioned_table ? select * from Non_Partitioned_tableselect * from Partitioned_table什么区别?

Partitioning is unlikely to have any affect on a query like select * from table_name; 分区不太可能对查询产生任何影响,例如select * from table_name;

It won't help performance. 这对性能没有帮助。

A common misconception about partitioning is that simply dividing the table into chunks improves performance. 关于分区的一个常见误解是,将表简单地分成块可以提高性能。 Unless you are taking advantage of a specific partitioning feature, such as partition pruning or partition-wise joins, it's much better to let Oracle decide how to divide the work. 除非您利用特定的分区功能(例如分区修剪或分区明智的连接),否则最好让Oracle决定如何划分工作。 For example, with parallel processing, Oracle can just as easily divide up the work into block range granules instead of partition granules. 例如,通过并行处理,Oracle可以轻松地将工作划分为块范围粒度而不是分区粒度。

It probably won't hurt performance. 它可能不会损害性能。

There's a little extra overhead with parsing; 解析会有一些额外的开销; more metadata to gather and analyze, more optimizer decisions to evaluate. 收集和分析更多的元数据,评估更多的优化程序决策。 In practice I've never noticed a significant difference just from partitioning. 在实践中,我从来没有注意到分区带来的显着差异。 I've definitely seen some unusual behavior with complex partition pruning decisions, but that's not relevant to this simple statement. 我肯定已经看到了一些复杂的分区修剪决策的异常行为,但这与该简单语句无关。

There's a little extra data to read; 还要读取一些额外的数据。 more segments may mean more wasted space. 更多的细分可能意味着更多的浪费空间。 In practice, with defaults and a normal number of partitions, this extra overhead is not a big deal. 在实践中,使用默认值和正常数量的分区,此额外开销并不大。 Especially with deferred segment creation , where an empty partition takes up 0 bytes. 特别是在创建延迟段时 ,空分区占用0个字节。 Although that feature only works with partitions starting with 11.2.0.2. 尽管该功能仅适用于从11.2.0.2开始的分区。

But things can go very poorly in some extreme examples. 但事情可以去非常差在一些极端的例子。 For example, if you set a large and uniform extent size, or disable deferred segment creation, or create a table with thousands of partitions each with only a single row. 例如,如果您设置一个大而统一的扩展区大小,或者禁用延迟的段创建,或者创建一个包含数千个分区的表,每个分区只有一行。 In that case, a simple select statement could takes minutes instead of a fraction of a second. 在这种情况下,一个简单的select语句可能需要几分钟而不是一秒钟的时间。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 当您运行查询“ SELECT * FROM table_name WHERE column_name;”时,会发生什么情况? - What is happening when you run the query “SELECT * FROM table_name WHERE column_name;”? select_from(table_name)中的table_name是什么类型? - What is the type of table_name in select_from(table_name)? 如何在select * from中动态选择 <table_name> 分区(分区名称)? - how to select dynamically in select * from <table_name> partiton (Partition name)? sp_whoisactive导致未知查询:“Insert Into <table_name> 选择*,%% bmk %%来自 <table_name> 选项(maxdop 1)“ - sp_whoisactive resulting an unknown query: “Insert Into <table_name> select *,%%bmk%% from <table_name> option (maxdop 1)” &#39;select * from [table_name]&#39;是一个游标吗? - 'select * from [table_name]' is secretly a cursor? SQL:如何使用信息架构中的Table_Name和Pivoted Column_Name构建选择查询 - SQL: How to build a select query with Table_Name and Pivoted Column_Name from Information Schema 如何减少具有200k +记录的表的select * from table_name查询执行时间? - How to reduce select * from table_name query execution time for table with 200k+ records? SELECT MAX(col1) FROM<table_name> 子查询,在哪里<table_name>基于来自父查询的值</table_name></table_name> - SELECT MAX(col1) FROM <table_name> sub-query, where <table_name> is based on a value from the parent-query 相当于“SELECT * FROM(SELECT table_name FROM ...)”的东西? - Something equivalent to “SELECT * FROM (SELECT table_name FROM…)”? Oracle:select * from(select table_name from ...)? - Oracle: select * from (select table_name from … )?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM