Skip to content
pvmehta.com

pvmehta.com

  • Home
  • About Me
  • Toggle search form
  • lck.sql Oracle
  • Implementation of key based authentications Linux/Unix
  • 10g RAC: Troubleshooting CRS Root.sh Problems Oracle
  • find_cons.sql Oracle
  • sesswait.sql Oracle
  • Rollback force for distributed transactions Oracle
  • Unix split command to split files Linux/Unix
  • oracle Dba site Oracle
  • TRUNCATE table and disabling referential constraints. Oracle
  • Export With Query Another Example. Oracle
  • Oracle Release Explaination Oracle
  • Does DBMS_JOB recompute the NEXT_DATE interval after or before Oracle
  • Explain Plan Doesn’T Change For Sql After New Statistics Generated Oracle
  • Find nth max and min. Oracle
  • Find execution plan from dba_hist_sql_plan for a specific SQL_ID and PLAN_HASH_VALUE fplan.sql Oracle

TABLE SIZING WITH DB_BLOCK ARCHITECTURE Reference : Metalink note : 10640.1

Posted on 14-Oct-2005 By Admin No Comments on TABLE SIZING WITH DB_BLOCK ARCHITECTURE Reference : Metalink note : 10640.1

===================================================================

STEP-I First, calculate the total block header size:

===================================================================

block header = fixed header + variable transaction header + table directory + row directory

where:

fixed header = 57 bytes (the 4 bytes at the end of the block have already been taken account of in the 24 bytes for the cache header)

variable transaction header = 23 * i where i is the value of INITRANS for the table, or can grow dynamically up to MAXTRANS.

table directory = 4 * n where n is the number of tables. n = 1 for non-clustered tables.

row directory = 2 * x where x is the number of rows in the block.

Using the above formula, the initial block header size for a non-clustered table with INITRANS = 1 is:

block header = 57 + 23 + 4 + 2x = (84 + 2x) bytes

The space reserved for data within the block, as specified by PCTFREE, is calculated as a percentage of the block size minus the block header.

available data space = (block size – total block header) – ((block size – total block header) * (PCTFREE/100))

For example, with PCTFREE = 10 and a block size of 2048, the total space for new data in a block is:

available data space = (2048 – (84 + 2x)) – ((2048 – (84 + 2x)) *(10/100))

= (1964 – 2x) – ((2048 – 84 – 2x) * (10/100))

= (1964 – 2x) – (1964 – 2x) * 0.1

= (1964 – 2x – 196 + 0.2x) bytes

= (1768 – 1.8x) bytes

==================================================================================

Step II Now, calculate the combined data space required for an average row.

==================================================================================

Calculating this depends on the following:

1. The number of columns in the table definition.

2. The datatypes used for each column.

3. The average value size for variable length columns.

A test database similar to the production database will be helpful here. To calculate the combined data space for an average row in a table, use the following query:

SELECT AVG(NVL(VSIZE(col1), 1)) +

AVG(NVL(VSIZE(col2), 1)) +

… +

AVG(NVL(VSIZE(coln), 1)) “SPACE OF AVERAGE ROW”

FROM table_name;

col1, col2, … , coln are the column names of the table and table_name is the table being evaluated.

Oracle, SQL scripts

Post navigation

Previous Post: FGA Part-I
Next Post: My Test Case On 21-OCT-2005

Related Posts

  • Oracle Statspack survival Guide Oracle
  • Find Plan Hash value fphv.sql Oracle
  • Does DBMS_JOB recompute the NEXT_DATE interval after or before Oracle
  • Committing distributed transaction using commit force Oracle
  • UTL_FILE test program Oracle
  • DETERMINING WHICH INSTANCE OWNS WHICH SHARED MEMORY & SEMAPHORE SEGMENTS Oracle

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Categories

  • AWS (2)
  • Azure (1)
  • Linux/Unix (149)
  • Oracle (392)
  • PHP/MYSQL/Wordpress (10)
  • Power-BI (0)
  • Python/PySpark (7)
  • RAC (17)
  • rman-dataguard (26)
  • shell (149)
  • SQL scripts (341)
  • Uncategorized (0)
  • Videos (0)

Recent Posts

  • load SPM baseline from cursor cache05-Jun-2025
  • Drop all SPM baselines for SQL handle05-Jun-2025
  • Load SPM baseline from AWR05-Jun-2025
  • Drop specific SQL plan baseline – spm05-Jun-2025
  • findinfo.sql (SQL for getting CPU and Active session info)27-May-2025
  • SQL Tracker by SID sqltrackerbysid.sql22-Apr-2025
  • How to connect to Oracle Database with Wallet with Python.21-Mar-2025
  • JSON/XML Types in Oracle18-Mar-2025
  • CPU Core related projections12-Mar-2025
  • Exadata Basics10-Dec-2024

Archives

  • 2025
  • 2024
  • 2023
  • 2010
  • 2009
  • 2008
  • 2007
  • 2006
  • 2005
  • Reading parameter file and printing Linux/Unix
  • sqlnet.ora paramters Oracle
  • checking connectivity between two servers Linux/Unix
  • Read CSV file using PySpark Python/PySpark
  • True Session Wait Activity in Oracle 10g Verygood Oracle
  • On solaris 10, “S” link is not part of $ORACLE_HOME/bin/oracle as default. ( For 9.2.0.8) Oracle
  • rm_backup_arch_file.ksh Linux/Unix
  • load SPM baseline from cursor cache Oracle

Copyright © 2025 pvmehta.com.

Powered by PressBook News WordPress theme