What is the difference between Global temporary tables and Volatile temporary tables?

Global Temporary tables (GTT):-

1. Whenever we create GTT, its definition is stored into Data Dictionary.

2. Whenever we insert data into GTT,data is stored into temp space. So definition of the table will be active until we can delete using the drop table statement and data remains active up to end of the session only
3. We can Collect statistics on Global temporary tables.

Volatile Temporary tables (VTT) :-

1. Whenever we create VTT, its Definition is stored into System cache.

2. Whenever we insert data into VTT, data is stored into spool space.So table definition and data both are remains active only up to session end only. 
3. We cannot able to collect statistics on volatile tables.


1 comment:

  1. Global Temporary Table - Once created, the structure can be shared with different sessions and users but the data remains private to the session who loaded it. Session ends, its private data gets deleted.
    Volatile Table - Only the session in which it is created can access the table structure and data. Session ends, table gets dropped.

    ReplyDelete