- 浏览: 1542794 次
- 性别:
- 来自: 上海
文章分类
- 全部博客 (532)
- 软件设计师 (7)
- PSP (5)
- NET MD (9)
- Hibernate (8)
- DIY (51)
- Work (43)
- GAME (24)
- 未分类 (44)
- iPod (6)
- MySQL (39)
- JSP (7)
- 日语能力考试 (36)
- 小说 (4)
- 豆包网 (23)
- 家用电脑 (7)
- DB2 (36)
- C/C++ (18)
- baby (9)
- Linux (13)
- thinkpad (23)
- OA (1)
- UML (6)
- oracle (24)
- 系统集成 (27)
- 脑梗塞 (6)
- 车 (8)
- MainFrame (8)
- Windows 7 (13)
- 手机 (8)
- git (12)
- AHK (2)
- COBOL (2)
- Java (9)
最新评论
-
安静听歌:
... ...
UUID做主键,好还是不好?这是个问题。 -
lehehe:
http://www.haoservice.com/docs/ ...
天气预报 -
lehehe:
[url http://www.haoservice.com/ ...
天气预报 -
liubang201010:
监控TUXEDO 的软件推荐用这个,专业,权威.并能提供报警和 ...
(转载)Tuxedo中间件简介 -
tinkame:
Next[j] =-1 当j=0时;=Max{k|0<k ...
KMP字符串模式匹配详解
Summary: This article helps the new DB2® database administrator understand the importance of table spaces and buffer pools. The article also explains how properly designing and tuning table spaces and buffer pools can enhance database performance.[Originally written in 2002, this article has been updated for IBM DB2 V9.7 for Linux®, UNIX®, and Windows®.] View more content in this series Tags for this article: administration, basic, basics, buffer, buffer_pool, bufferpool, buffpage,configuration_and_administration, database, databases_and_data_management... more tags Date: 22 Apr 2010 (Published 19 Dec 2002) For the database administrator (DBA) who is just stepping into the world of DB2 or for the prospective DBA, the design and performance choices for a new database can be very confusing. This article discusses two areas in which the DBA has important choices to make: table spaces and buffer pools. The design and tuning of table spaces and buffer pools can have a profound impact on how the DB2 server performs. In this article, the examples use DB2 Version 9.7, Enterprise Server Edition. Most of the examples also apply to downlevel versions, unless otherwise indicated. The article does the following: All data for a database is stored in a number of table spaces. You can think of a table space as a child and a database as its parent, where the table space (child) cannot have more than one database (parent). Because there are different uses for table spaces, they are classified according to their usage and how they will be managed. There are five different table spaces, named according to their usage: Table spaces can be managed in one of two ways: However, containers cannot be dropped from SMS table spaces, and adding new ones is restricted to partitioned databases. In version 9.1 and above, the only default SMS tablespace created during database creation is TEMPSPACE1. Listing 1 shows how to increase container sizes: You can also use options such as EXTEND or REDUCE to increase or decrease the size of a container. How to create and view your table spaces When you create a database, three table spaces are created (SYSCATSPACE, TEMPSPACE1, and USERSPACE1). Listing 2 shows you how to create a database called testdb, connect to it, and list the table spaces using the DB2 command window or the UNIX command line. Listing 3 shows the output from the LIST TABLESPACES command. The CREATE DATABASE command automatically creates the three table spaces in Listing 3. The user can override the default table space creation by including table space specifications in the command, but a catalog table space and at least one regular or large and one system temporary table space must be created at database creation time. More table spaces of all types (except catalog table space) can be created either with the CREATE DATABASE command, or later using the CREATE TABLESPACE command. Each table space has one or more containers. Again, you might think of a container as being a child and a table space as its parent. Each container can belong to only a single table space, but a table space can have many containers. Containers can be added to or dropped from a DMS table space, and their sizes can be modified. Containers can only be added to SMS table spaces on partitioned databases in a partition that does not yet have a container allocated for the table space. When new containers are added, an automatic rebalancing distributes the data across all containers. Rebalancing does not prevent concurrent access to the database. There are several settings that you can specify for table spaces, either when you create them or later with an ALTER TABLESPACE statement. The following list describes the settings. Table spaces are limited to 16,777,216 pages, so choosing a larger page size will increase the capacity of the table space. Example of a CREATE TABLESPACE statement Listing 4 creates a regular table space, including all the settings from this article. How to view your table space attributes and containers Specifying the SHOW DETAIL option of the LIST TABLESPACES command shows additional information: Listing 5 shows the output for the USERSPACE1 table space. By default, the three table spaces created at database creation time will be listed. To list the containers needed to use the Tablespace ID from the output above, enter The command lists all containers for the specified table space. The path in Listing 6 points to where the container physically resides. A buffer pool is associated with a single database and can be used by more than one table space. When considering a buffer pool for one or more table spaces, you must ensure that the table space page size and the buffer pool page size are the same for all table spaces that the buffer pool services. A table space can only use one buffer pool. When the database is created, a default buffer pool named IBMDEFAULTBP is created, which is shared by all table spaces. More buffer pools can be added using the CREATE BUFFERPOOL statement. The buffer pool size defaults to the size specified by the BUFFPAGE database configuration parameter, but you can override it by specifying the SIZE keyword in the CREATE BUFFERPOOL command. Adequate buffer pool size is essential to good database performance, because it will reduce disk I/O, which is the most time consuming operation. Large buffer pools also have an effect on query optimization, because more of the work can be done in memory. Example of CREATE BUFFERPOOL statement For an example of the CREATE BUFFERPOOL statement, enter: This buffer pool is assigned to USERSPACE3 on this article's CREATE TABLESPACE example and is created before creating the table space. Note that the page sizes of 8K for the buffer pool and table space are the same. If you create the table space after creating the buffer pool, you can leave out the BUFFER POOL BP3 syntax in the CREATE TABLESPACE statement. Instead, you can use the ALTER TABLESPACE command to add the buffer pool to the existing table space by entering How to view your buffer pool attributes You can list buffer pool information by querying the SYSCAT.BUFFERPOOLS system view, as shown in Listing 7. To find out which buffer pool is assigned to table spaces, run the query shown in Listing 8. The BUFFERPOOLID is shown in the query in Listing 8, enabling you to see which buffer pool is associated with each table space. Visual diagram of how a database holds table spaces Now that you know what a table space and buffer pool are and how to create them, Figure 1 shows an example of how they are visually organized within a database. The example database has five table spaces: one catalog, two regular, one large, and one system temporary table space. No user temporary table space was created. There are eight containers. In this example, buffer pools might be assigned as follows: Examining performance implications In general, when designing table space and container placement on physical devices, the goal is to maximize I/O parallelism and buffer utilization. To achieve that goal, you need a thorough understanding of the database design and applications. Only then can you determine such issues as whether segregating two tables to different devices will lead to parallel I/O, or whether a table should be created in a separate table space so it can be fully buffered. Start designing the physical layout of a new database by designing the table space organization, as shown in the following steps. This process is iterative, and the design should be verified with stress-testing and benchmarking. Clearly, arriving at the best design can be quite an intensive effort, so the time it takes can only be justified if the database performance must be the best possible. As a rule: Often a slight degradation in performance is well worth the reduced complexity of administering and maintaining a simpler database design. DB2 has sophisticated resource-management logic, which standardly produces very good performance without elaborate design. Each table, depending on how it is accessed most frequently, has a most efficient set of table space settings: PAGESIZE, EXTENTSIZE, and PREFETCHSIZE. The catalog table space and system temporary table spaces should usually be allocated as SMS. There is no reason to have more than one temporary table space of the same page size, and usually one with the largest page size is sufficient. The salient question is whether to split up the user data into multiple table spaces or not. One consideration is the utilization of pages. Rows cannot be split between pages, so tables with long rows require the appropriate page size. However, there cannot be more than 255 rows on a page, so tables with short rows do not utilize the whole page. For example, a table with a row length of 12 bytes placed in a table space with 32K page size utilizes only about 10% of each page, which is calculated as (255 rows * 12 bytes) + 91 bytes of overhead) / 32k page size = ~10%. This is only a consideration if the table is large, which means the wasted space is significant. It also makes I/O and buffering less efficient, because the actual useful content of each page is small. If a table can either be placed into a smaller page size table space or fully utilize a larger page size, then the most frequent method of access determines which one is better. If typically more rows are accessed sequentially (maybe the table is clustered), then the larger page size is more efficient. If rows are accessed randomly, then the smaller page size enables DB2 to make better use of the buffer, because more pages fit into the same storage area. After you group the tables by page size, access frequency and type determine whether further grouping the data into separate table spaces is warranted. EXTENTSIZE is the number of pages of data that will be written to a container before writing to the next container (if multiple containers exist in the table space). PREFETCHSIZE specifies the number of pages to be read from the table space when data prefetching is being performed. Prefetching is used when the Database Manager determines that sequential I/O is appropriate and that prefetching can help to improve performance (typically large table scans). It is a good practice to explicitly set the PREFETCHSIZE value as a multiple of the EXTENTSIZE value for your table space and the number of table space containers. For example, if the EXTENTSIZE is 32 and there are four containers, then good PREFETCHSIZEs would be 128, 256, and so on. If one or more heavily used tables require a different set of these parameters than the values that are best for the rest of the table space performance, put the heavily used tables into a separate table space to improve overall performance. If prefetching is an important factor in a table space, consider setting aside part of the buffer for block-based I/O. The block size should be equal to the PREFETCHSIZE. The most important reason to use more than one user table space is to manage buffer utilization. A table space can be associated with only one buffer pool, but one buffer pool can be used for more than one table space. The goal of buffer pool tuning is to help DB2 make the best possible use of the memory available for buffers. The overall buffer size has a significant effect on DB2 performance, because a large number of pages can significantly reduce I/O, which is the most time-consuming operation. However, if the total buffer size is too large, and there is not enough storage to allocate them, a minimum system buffer pool for each page size is allocated, and performance is sharply reduced. To calculate the maximum buffer size, DB2 considers all other storage utilization, the operating system, and any other applications. Once the total available size is determined, this area can be divided into different buffer pools to improve utilization. If there are table spaces with different page sizes, there must be at least one buffer pool per page size. Having more than one buffer pool can preserve data in the buffers. For example, you might have a database with many very-frequently used small tables, which would normally be in the buffer in their entirety to be accessible very quickly. You might also have a query that runs against a very large table that uses the same buffer pool and involves reading more pages than the total buffer size. When this query runs, the pages from the small, very frequently used tables are lost, making it necessary to re-read them when they are needed again. If the small tables have their own
http://www.ibm.com/developerworks/data/library/techarticle/0212wieser/index.html
DB2 Basics: Table spaces and buffer pools
Level: Introductory
PDF: A4 and Letter (63KB | 16 pages)Get Adobe® Reader®
Also available in: Russian Portuguese Spanish
Activity: 62684 views
Comments: 12 (View | Add comment - Sign in)
Rate this article
Listing 1. Increase container size
ALTER TABLESPACE TS1 RESIZE (FILE '/conts/cont0' 2000,
DEVICE '/dev/rcont1' 2000, FILE 'cont2' 2000)
Listing 2. Create, connect, and list
CREATE DATABASE testdb
CONNECT TO testdb
LIST TABLESPACES
Listing 3. Output from LIST TABLESPACES command
Tablespaces for Current Database
Tablespace ID = 0
Name = SYSCATSPACE
Type = Database managed space
Contents = All permanent data. Regular table space.
State = 0x0000
Detailed explanation:
Normal
Tablespace ID = 1
Name = TEMPSPACE1
Type = System managed space
Contents = System Temporary data
State = 0x0000
Detailed explanation:
Normal
Tablespace ID = 2
Name = USERSPACE1
Type = Database managed space
Contents = All permanent data. Large table space.
State = 0x0000
Detailed explanation:
Normal
Table 1. Implications of page size
Page size
Row size limit
Column count limit
Maximum capacity
(DMS tablespace)
4 KB
4 005
500
64 GB
8 KB
8 101
1 012
128 GB
16 KB
16 293
1 012
256 GB
32 KB
32 677
1 012
512 GB
Listing 4. Creating a table space
CREATE TABLESPACE USERSPACE3
PAGESIZE 8K
MANAGED BY SYSTEM
USING ('d:\usp3_cont1', 'e:\usp3_cont2', 'f:\usp3_cont3')
EXTENTSIZE 64
PREFETCHSIZE 32
BUFFERPOOL BP3
OVERHEAD 7.5
TRANSFERRATE 0.06
LIST TABLESPACES SHOW DETAIL
.
Listing 5. Output from LlST TABLESPACES SHOW DETAIL command
Tablespaces for Current Database
Tablespace ID = 2
Name = USERSPACE1
Type = Database managed space
Contents = All permanent data. Large table space.
State = 0x0000
Detailed explanation:
Normal
Total pages = 8192
Useable pages = 8160
Used pages = 96
Free pages = 8064
High water mark (pages) = 96
Page size (bytes) = 4096
Extent size (pages) = 32
Prefetch size (pages) = 32
Number of containers = 1
LIST TABLESPACE CONTAINERS FOR 2
.
Listing 6. Output from LlST TABLESPACES CONTAINERS command
Tablespace Containers for Tablespace 2
Container ID = 0
Name = C:\DB2\NODE0000\SQL00004\SQLT0002.0
Type = Path
CREATE BUFFERPOOL BP3 SIZE 2000 PAGESIZE 8K
ALTER TABLESPACE USERSPACE3 BUFFERPOOL BP3
.
Listing 7. Querying SYSCAT.BUFFERPOOLS
SELECT * FROM SYSCAT.BUFFERPOOLS
BPNAME BUFFERPOOLID DBPGNAME NPAGES PAGESIZE ESTORE NUMBLOCKPAGES BLOCKSIZE
------------ ------------ -------- ------ -------- ------ ------------- ---------
IBMDEFAULTBP 1 - 1000 4096 N 0 0
1 record(s) selected.
Listing 8. Querying SYSCAT.TABLESPACES
SELECT TBSPACE, BUFFERPOOLID FROM SYSCAT.TABLESPACES
TBSPACE BUFFERPOOLID
----------- ------------
SYSCATSPACE 1
TEMPSPACE1 1
USERSPACE1 1
3 record(s) selected.
Figure 1. Table spaces and buffer pools
发表评论
(转)浅谈IBM DB2的数据库备份与恢复
2011-11-23 16:41
1845
(转)DB2备份恢复数据库步骤
2011-11-23 16:23
948
(转)DB2 SQL Error: SQLCODE=-964, SQLSTATE=57011的原因及解决方法
2011-11-07 15:03
9603
(转)DB2解决“数据库日志已满”操作 SQLCODE=-964
2011-11-07 14:49
2691
(转)用哪个DB2命令查看DB2 instance是启动还是停止的?
2011-09-30 13:25
3645
(转)论 LOAD 与 IMPORT 中的 codepage 转换
2011-07-11 14:55
1162
(转)DB2导出数据库表结构和数据
2011-07-11 14:19
1561
(转)DB2 9 中基于字符的字符串函数
2011-06-16 11:32
1429
(转)db2look:生成 DDL 以便重新创建在数据库中定义的对象
2011-05-31 14:56
1645
(转)【俊哥儿张】DB2:学习 DB2LOOK 命令
2011-05-31 14:54
1392
(转)Recreate optimizer access plans using db2look
2011-05-31 14:53
1265
(转)DB2中ALTER TABLE为什么需要REORG操作?
2011-05-12 13:10
1683
(转)DB2 3.2.2 表空间维护
2011-05-11 12:53
1180
(转)DB2 数据类型
2011-05-11 12:52
4000
(转)SQL1092N "USER" does not have the authority to perform therequested command -
2011-03-23 17:39
5482
(转)DB2 sqlstate 57016 原因码 "7"错误详解
2011-03-07 17:38
1496
(转)在英语 OS 上设置 DB2 UDB 版本 8 中的混合字节字符集(MBCS)数据库
2011-02-16 16:25
1602
(转)DB2 CODEPAGE List
2011-02-15 15:15
1415
(转)快速参考: DB2 命令行处理器(CLP)中的常用命令
2010-11-11 10:44
970
(转)DB2 and IBM's Processor Value Unit pricing
2010-01-13 17:36
1374
相关推荐
Python Basics: A Self-Teaching Introduction By 作者: H. Bhasin ISBN-10 书号: 1683923537 ISBN-13 书号: 9781683923534 出版日期: 2018-12-17 pages 页数: (604) Python has become the language of choice ...
Blockchain Basics: A Non-Technical Introduction in 25 Steps By 作者: Daniel Drescher ISBN-10 书号: 1484226038 ISBN-13 书号: 9781484226032 Edition 版本: 1st ed. 出版日期: 2017-03-16 pages 页数: (276 ) ...
Blockchain Basics A Non-Technical Introduction in 25 Steps 英文epub 本资源转载自网络,如有侵权,请联系上传者或csdn删除 本资源转载自网络,如有侵权,请联系上传者或csdn删除
### IC Layout基础知识详解 #### 基本电路理论回顾与半导体材料介绍 在《IC Layout基础知识:实用指南》这本书中,作者Christopher Saint 和 Judy Saint 为读者提供了深入了解集成电路(Integrated Circuit, IC)...
2. Displaying Help and Features 29 3. Bit Rate, Frame Rate and File Size 60 4. Resizing and Scaling Video 64 5. Cropping Video 69 6. Padding Video 73 7. Flipping and Rotating Video 77 8. Blur, Sharpen...
数字滤波器是一种用于信号处理的电子设备,其作用是根据特定的频率选择性,允许某些频率的信号通过,同时衰减或阻止其他频率的信号。数字滤波器在电子设备中广泛应用,特别是在音频和视频设备、通信、控制和雷达系统...
`django-auth-basics`项目,正如其标题所示,是针对Django身份验证基础知识的一个详细解释,旨在帮助初学者更好地理解和应用Django的认证机制。 **Django身份验证系统组件** 1. **User模型**:Django提供了一个...
HANA是一个软硬件结合体,提供高性能的数据查询功能,用户可以直接对大量实时业务数据进行查询和分析,而不需要对业务数据进行建模、聚合等。
Lander’s self-contained chapters start with the absolute basics, offering extensive hands-on practice and sample code. You’ll download and install R; navigate and use the R environment; master basic...
Multimedia handling with a fast audio and video encoder Multimedia handling with a fast audio and video encode Multimedia handling with a fast audio and video encode Multimedia handling with a fast ...
本教程“MySQL_basics:geekbarains MySQL基础”旨在为初学者提供一个全面的起点,了解MySQL的核心概念和操作。 1. **安装与配置** - 安装MySQL服务器:在不同的操作系统(如Windows、Linux和Mac OS)上安装MySQL的...
**BASiCS**,全称为Bayesian Analysis of Single Cell Sequencing Data,是一个专门用于单细胞测序数据的贝叶斯分析工具。该工具旨在处理单细胞RNA测序(scRNA-seq)数据,这是一种在单个细胞层面上研究基因表达的高...
Basics: Multimedia, Audio and Video Chapter 6. Multimedia: Preparing Your Media Chapter 7. Multimedia: Using Native HTML5 Audio Chapter 8. Multimedia: Using Native HTML5 Video Chapter 9. Multimedia: ...
NodeJs_Basics:这是一个致力于学习NOdejs的项目
graphql-basics:GraphQL学习基础
力与运动:基础知识“ Force and Motion:Basics”是HTML5中的教育模拟,由科罗拉多大学博尔德分校的提供。 有关此模拟的说明,相关资源以及指向已发布版本的链接,。尝试一下! 文献资料是PhET仿真开发的最完整指南...
matlab中存档算法代码机器学习基础研讨会 该研讨会的目的是回顾有关机器学习的最基本主题并实现基本的线性回归模型。 设置 对于这个wirkshop,我们需要一种数值演算编程语言,为此,我们可以使用以下选项: ...