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建立散列子分区,每月的数据形成一个组合分区,会使每个分区的记录数分布均匀、查询速度提高、易于备份和删除。因为大多数的统计和查询是在一个月的范围内,而且从实际的查询效果看,跨月和跨年数据的统计和查询速度,也比未分区的时候大大缩短,效果非常明显。

MySQLoffersvariousstorageengines,eachsuitedfordifferentusecases:1)InnoDBisidealforapplicationsneedingACIDcomplianceandhighconcurrency,supportingtransactionsandforeignkeys.2)MyISAMisbestforread-heavyworkloads,lackingtransactionsupport.3)Memoryengineis

Common security vulnerabilities in MySQL include SQL injection, weak passwords, improper permission configuration, and unupdated software. 1. SQL injection can be prevented by using preprocessing statements. 2. Weak passwords can be avoided by forcibly using strong password strategies. 3. Improper permission configuration can be resolved through regular review and adjustment of user permissions. 4. Unupdated software can be patched by regularly checking and updating the MySQL version.

Identifying slow queries in MySQL can be achieved by enabling slow query logs and setting thresholds. 1. Enable slow query logs and set thresholds. 2. View and analyze slow query log files, and use tools such as mysqldumpslow or pt-query-digest for in-depth analysis. 3. Optimizing slow queries can be achieved through index optimization, query rewriting and avoiding the use of SELECT*.

To monitor the health and performance of MySQL servers, you should pay attention to system health, performance metrics and query execution. 1) Monitor system health: Use top, htop or SHOWGLOBALSTATUS commands to view CPU, memory, disk I/O and network activities. 2) Track performance indicators: monitor key indicators such as query number per second, average query time and cache hit rate. 3) Ensure query execution optimization: Enable slow query logs, record and optimize queries whose execution time exceeds the set threshold.

The main difference between MySQL and MariaDB is performance, functionality and license: 1. MySQL is developed by Oracle, and MariaDB is its fork. 2. MariaDB may perform better in high load environments. 3.MariaDB provides more storage engines and functions. 4.MySQL adopts a dual license, and MariaDB is completely open source. The existing infrastructure, performance requirements, functional requirements and license costs should be taken into account when choosing.

MySQL uses a GPL license. 1) The GPL license allows the free use, modification and distribution of MySQL, but the modified distribution must comply with GPL. 2) Commercial licenses can avoid public modifications and are suitable for commercial applications that require confidentiality.

The situations when choosing InnoDB instead of MyISAM include: 1) transaction support, 2) high concurrency environment, 3) high data consistency; conversely, the situation when choosing MyISAM includes: 1) mainly read operations, 2) no transaction support is required. InnoDB is suitable for applications that require high data consistency and transaction processing, such as e-commerce platforms, while MyISAM is suitable for read-intensive and transaction-free applications such as blog systems.

In MySQL, the function of foreign keys is to establish the relationship between tables and ensure the consistency and integrity of the data. Foreign keys maintain the effectiveness of data through reference integrity checks and cascading operations. Pay attention to performance optimization and avoid common errors when using them.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

WebStorm Mac version
Useful JavaScript development tools

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),

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

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

SublimeText3 English version
Recommended: Win version, supports code prompts!
