search
HomeDatabaseMysql TutorialOracle 数据表分区的策略

Oracle 数据表分区的策略

正在看的ORACLE教程是:Oracle 数据表分区的策略。本文描述通过统计分析出医院信息系统需分区的表,对需分区的表选择分区键,即找出包括在你的分区键中的列(表的属性),对大型数据的管理比较有意义, 本文的工作在Oracle8.1.6下实现。

  Oracle虽然是一个大型的DBMS,但如果不对记录比较多的表进行处理,仍然发挥不了Oracle管理大型数据的强大功能,因此对某些表进行分区,具有如下优点:

  分区表中每个分区可以在逻辑上认为是一个独立的对象;

  可以在一个表中的一个或多个分区上进行如删除、移动、析分等维护操作,而不会影响其它分区,具有分区独立性;

  如果选择合适的分区策略,会大大的加快数据的查询速度。

  一 找出需分区的表

  本节描述通过统计分析出医院His系统需分区的表,对需分区的表找出包括在你的分区键中的列(表的属性),即选择分区键。

  1、基于访问频度找出需分区的表

  Oracle8i允许访问数据库中的审核信息,借助于收集的审核信息,设计者能够确定哪些表的数据是真正最频繁访问的,即找出那些表,需要进行分区。

  打开审核:在作为SYS或SYSSTEM登录到数据库后,动行如下脚本,打开对象的审核功能。


  这些代码的运行将产生“audon.sql”的输出文件,它包含下面清单中所示格式的语句


  使用命令@audon.sql激活上述代码以打开审核功能收集收集审核信息,建立一个表以保存概要信息:


  将审核信息从dba_audit_object表中取出并装入概要表中:


  关闭审核:


  这些代码的运行将产生“audoff.sql”的输出文件。

  使用命令@ audoff.sql激活上述代码以关闭上述对象的审核功能。

  清除审核信息:


  分析审核信息


  以上是HIS系统临床医嘱部分24小时内对表的访问情况,从上面的查询得表1-1。

  表1-1


  group_order_master( 医嘱套攴主记录) 、group_order_item(医嘱套攴明细), 表的行数比较少,不适合分区;drug_stock(药品库存)虽然存取频率比较高,但表的行数比较少,因此也不适合分区。我们选择表的行数比较多、存取频率比较高的表作分区处理,如 doctor_orders、orders、orders_costs,考虑到doctor_orders是医生工作站上医生开的医嘱,orders是由doctor_orders生成、护士工作站上执行的医嘱,两个表结构类似,而医嘱与药品、卫生材料、计费联系比较密切的是Orders,因此重点介绍对表orders的处理。

  2、基于列值选择分区键

  使用Sql*plus下用命令Analyze收集末分区表的统计信息,按照Oracle推荐的取样20%进行分析,并将统计结果保存在数据字典中。


  对DBA_TAB_COLUMNS数据字典视图进行查询

  产生表1-2


  表1-2


  从表1-2中,我们可以看到欲分区表的各个候选分区键的分布频谱,ORDER_CODE(医嘱代码)键值没有出现一种均匀分布,用它作分区键,明显不合适;

  ORDER_CLASS(医嘱类别代码)、ORDERING_DEPT(开医嘱科室代码),键值出现均匀分布,如用它的各个键值作基于范围的分区,每个分区具有的记录数比较均匀,但这种方法对于每天增加上万条记录的表来看,显然不是最优的。如果选用START_DATE_TIME(医嘱开始时间)建立范围分区,每月的数据建立一个分区,在每个分区内基于ORDERING_DEPT建立散列子分区,每月的数据形成一个组合分区,会使每个分区的记录数分布均匀、查询速度提高、易于备份和删除。因为大多数的统计和查询是在一个月的范围内,而且从实际的查询效果看,跨月和跨年数据的统计和查询速度,也比未分区的时候大大缩短,效果非常明显。
Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
How do you alter a table in MySQL using the ALTER TABLE statement?How do you alter a table in MySQL using the ALTER TABLE statement?Mar 19, 2025 pm 03:51 PM

The article discusses using MySQL's ALTER TABLE statement to modify tables, including adding/dropping columns, renaming tables/columns, and changing column data types.

How do I configure SSL/TLS encryption for MySQL connections?How do I configure SSL/TLS encryption for MySQL connections?Mar 18, 2025 pm 12:01 PM

Article discusses configuring SSL/TLS encryption for MySQL, including certificate generation and verification. Main issue is using self-signed certificates' security implications.[Character count: 159]

How do you handle large datasets in MySQL?How do you handle large datasets in MySQL?Mar 21, 2025 pm 12:15 PM

Article discusses strategies for handling large datasets in MySQL, including partitioning, sharding, indexing, and query optimization.

What are some popular MySQL GUI tools (e.g., MySQL Workbench, phpMyAdmin)?What are some popular MySQL GUI tools (e.g., MySQL Workbench, phpMyAdmin)?Mar 21, 2025 pm 06:28 PM

Article discusses popular MySQL GUI tools like MySQL Workbench and phpMyAdmin, comparing their features and suitability for beginners and advanced users.[159 characters]

How do you drop a table in MySQL using the DROP TABLE statement?How do you drop a table in MySQL using the DROP TABLE statement?Mar 19, 2025 pm 03:52 PM

The article discusses dropping tables in MySQL using the DROP TABLE statement, emphasizing precautions and risks. It highlights that the action is irreversible without backups, detailing recovery methods and potential production environment hazards.

How do you represent relationships using foreign keys?How do you represent relationships using foreign keys?Mar 19, 2025 pm 03:48 PM

Article discusses using foreign keys to represent relationships in databases, focusing on best practices, data integrity, and common pitfalls to avoid.

How do you create indexes on JSON columns?How do you create indexes on JSON columns?Mar 21, 2025 pm 12:13 PM

The article discusses creating indexes on JSON columns in various databases like PostgreSQL, MySQL, and MongoDB to enhance query performance. It explains the syntax and benefits of indexing specific JSON paths, and lists supported database systems.

How do I secure MySQL against common vulnerabilities (SQL injection, brute-force attacks)?How do I secure MySQL against common vulnerabilities (SQL injection, brute-force attacks)?Mar 18, 2025 pm 12:00 PM

Article discusses securing MySQL against SQL injection and brute-force attacks using prepared statements, input validation, and strong password policies.(159 characters)

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Tools

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool