Wednesday, January 23, 2013

Packdisk in Teradata


It is one of the last resorting options available to DBA's when the system runs out of Cylinders.Packdisk helps to pack up cylinders in AMP making space for more data. We need to note that
PACKDISK is an expensive operation on the system and it should be planned out so no parallel activities are run

Running PACKDISK on regular basis is part of Best Teradata practices. It also helps improve overall performance of the system .

How do you determine whether system is running out of space?

1. By using DBC.Diskspace ,

sum(currentperm)/1024/1024/1024 "cur_space_gb" ,
sum(maxperm)/1024/1024/1024 "max_space_gb",
case when ((max_space_gb - cur_space_gb)/max_space_gb) *100  < 25
then  'Warning! Packdisk has to be run'
else  'No Packdisk activity required!' end
from DBC.Diskspace ;

2. By using Showspace from Ferret utility.
this would display free space per cylinder.  When the free space is low,it would run minicylpacks which can impact the performance of system . So DBA's need to keep an eye on Free space per cylinder.

3. SHOWFSP another Ferret utility which is very useful in identifying particular tables that needs to packing.
It also shows amount of cylinders that can freed up by specifying Free space percent (FSP)

How to start PACKDISK?

please note that We can start /pause/ abort & continue packdisk whenever needed.
(type help to figure more options is you are not sure)

1. To start packdisk, go to ferret-> type PACKDISK
2. you can define range of FSP to start packdisk (say fsp =30 will start for cylinders having less than 30% free space)
3. Above option can be ignored and PACKDISK can be invoked for all cylinders)

Monday, January 7, 2013

Minicylpack in Teradata

MINICYLPACK is File system activity and is handled by Teradata by default.
This activity will exactly free one cylinder in an AMP and it is run automatically when the user request would need free cylinder or huge amount of space.
Cylinders are dedicated for PERM and SPOOL space separately.

MINICYLPACK is kind of last resort in system when the system is completely out of space and it is initiated. The Teradata file system will start to minicylpack when the number of free cylinders drops to the value set by MiniCylPackLowCylProd. The default is 10.

Say in above scenario, an AMP with 6 cylinders, the MiniCylPackLowCylProd is set to 1.
When the number of free cylinders goes below 1 i.e. 0, MINICYLPACKS is initiated and one cylinder is freed up during the process.

MINICYLPACK is resource intense activity because it causes lot of I/O's  in process of freeing up the data blocks  . It is suggested to run SHOWFSP from Ferret to see number of free cylinders available and cylinders that can be freed up and run PACKDISK to avoid unnecessary MINICYLPACK's

Thursday, January 3, 2013

Defragmentation in Teradata


This activity is automatically handled by Teradata File System when there is lot of fragmented sectors across cylinders.

Whenever a new table is created and data is loaded into it, the data is stored in Cylinders on a particular AMP. Data is always pushed into AMP cylinders as DATA BLOCKS.
IF the table is abused so much by doing DML operations like Update, delete and inserts on regular basis the data would have scattered across various cylinders as fragments.  When data blocks are scattered across cylinder lot of empty sectors occur. Well this space might be sufficient for small updates or inserts happening on table.
What if we needed large amount of Data to be inserted into table? The data blocks may not fit into cylinder as there are no continuous sectors available.

To overcome this problem Teradata File system (FS) runs the defragmentation to push all the data into continuous blocks.  This will create all the data blocks to be packed towards top of the cylinder making way for free sectors towards the bottom.   

Defragmentation does not free up cylinders, it only groups empty sectors and push towards bottom of cylinder
Can I run defragmentation manually?
Yes indeed!! By using ferret --> defrag   y ;
We should note that defragmentation will not run unless 25% of sectors are fragmented on cylinder.

By using “FORCE” option we can override this 25% factor and defragmentation is initiated.

Please note

  • Defragmentation is entirely controlled by DefragLowCylprod parameter in DBSControl . Setting this parameter high will result defragmentation to run frequently.  We can set up-to 65535 as it is maximum limit for cylinders per AMP.
  • Defragmentation consumes lot of CPU resources and hence should be planned out !!