DB Creation   «Prev  Next»

Lesson 6Setting the Block Size
ObjectiveChoose an appropriate block size for your database.

Setting the Block Size and choosing an appropriate Block Size for your Database

Choosing the appropriate block size for an Oracle Database involves a careful consideration of various factors related to the nature of your data and how it will be accessed. Here are the general steps you might follow:
  1. Understand the Default Block Size: Oracle databases have a default block size that can vary based on the operating system and the Oracle Database version. It's essential to know the default as it's often a good starting point for many databases.
  2. Assess Your Data Access Patterns: Consider how your data will be accessed. If your application predominantly uses large scans (e.g., full table scans for data warehousing applications), a larger block size may be beneficial. Conversely, if your application performs many random accesses (e.g., OLTP systems with lots of small transactions), a smaller block size might be more appropriate.
  3. Consider the Type of Data: Different types of data might benefit from different block sizes. For example, LOB (Large Object) data types might perform better with larger block sizes.
  4. Evaluate I/O Subsystem Characteristics: The block size should align with the I/O characteristics of your storage subsystem. For instance, if your storage system is optimized for larger I/O operations, setting a larger block size might improve performance by reducing the number of I/O operations.
  5. Review Oracle Database Features and Limitations: Some Oracle Database features and configurations might influence the optimal block size. For instance, features like Oracle RAC (Real Application Clusters) or certain index management strategies might have specific block size considerations.
  6. Test Different Block Sizes: After considering the above factors, it's wise to test different block sizes to observe their impact on performance in a development or staging environment that mirrors your production setup. Performance testing should include typical operations such as data loading, queries, updates, and backups.
  7. Consult Oracle Documentation and Best Practices: Oracle provides extensive documentation and best practices for database configuration, including block size considerations. Reviewing this material can provide valuable insights and recommendations tailored to your version of Oracle Database.
  8. Seek Expert Advice: If you're uncertain, consider consulting with Oracle experts or DBAs with experience in tuning Oracle Databases for similar workloads. They can provide insights and recommendations based on their experience.

It's important to note that changing the block size of an existing database can be complex and may require creating a new database and migrating data. Therefore, making an informed decision at the outset is crucial. Additionally, Oracle allows for the use of multiple block sizes within the same database (using the DB_nK_CACHE_SIZE parameter for non-default block sizes), but this is an advanced feature that should be used judan extension judiciously and with a clear understanding of the implications.


One of the most critical decisions that you face when creating a new database is that of choosing the database block size. The block is the level at which Oracle performs data input and output(I/O). Data is always read and written in blocks. The db_block_size parameter controls the block size. Some typical settings are:
db_block_size = 2048

db_block_size = 4096

db_block_size = 8192

Here are some points to keep in mind when choosing block size:
  1. On most operating systems, 2048 is the default block size. The maximum setting is usually 65536, but also varies by operating system. It is important to carefully choose the block size to be used with a new database, because once the database has been created, the block size cannot be changed. If you create a database, and later decide that you want to use a different block size, your only recourse is to create an entirely new database, and transfer all your data from the old to the new. Here are some of the pros and cons of large vs small block sizes: Each block contains a certain amount of housekeeping information as overhead. Larger block sizes contain a greater percentage of data with respect to this overhead.
  2. Large block sizes are often more I/O efficient for queries that scan large amounts of data.
  3. Small block sizes are often more I/O efficient when you have a lot of small updates taking place.
The database block size must be at least as big as your operating system block size and should be an integer multiple of that value as well. So if your operating system block size is 512 bytes, then a database block size of 4096 (512 * 8) is OK, but a database block size of 3,723 (not wholly divisible by 512) would hurt performance.

For the COIN database, let's go with a 4096 block size. That's a conservative and reasonably safe choice. If you are running Oracle, add the line db_block_size = 4096 to your initCOIN.ora file

SEMrush Software