Friday, June 8, 2018

How to resolve version tables in Netezza database?

whenever an alter happened on the Netezza table and NPS will make that table as version and collect the data from both version which is considered as costlier operation.
So we have to clear the  table versions periodically.

Versioned tables come about as a result of doing an
               ALTER TABLE <tablename> [ADD|DROP] COLUMN ...

          This results in multiple data stores for the table.  When you go to query
          the table, NPS must recombine the separate data stores back into a single
          entity.  This action will be performed automatically and on-the-fly.  But
          it does result in additional query overhead.  Therefore, it is a best
          practice to reconstitute the table as soon as practical by doing a

Here  is the script to find out the table versions in Netezza

/nz> nz_altered_tables 


# Of Versioned Tables         1                                        
     Total # Of Versions      2                                        
                                                                        
 Database |         Table Name         |       Size (Bytes)       | #  
Of Versions                                                            
----------+----------------------------+--------------------------+-----
----------                                                             
NZ_DB1 | TEST_TABLE_HISTORY |          197,591,957,504 |    



once you find the table ,then you need to clear the version using the below command.

 GROOM TABLE <tablename> VERSIONS;

No comments:

Post a Comment