Global Temporary Tables and Secondary Index

Database
Teradata Employee

Global Temporary Tables and Secondary Index

I was leading a Refresher Course today and a user asked a very interesting question around Global Temporary Tables and Secondary Indexes.

I did some digging and ascertained that indeed you can have secondary indexes on a global temp, but the question is around where the secondary index subtables are stored.

My thought would be that anything to do with a global temp table will be done in TEMP space, including the SI subtables. Is this correct?

Thanks!
2 REPLIES
Enthusiast

Re: Global Temporary Tables and Secondary Index

It logically make sense that they should be stored in temp database, but I have never found anywhere in the Teradata documents mentioning this explicitly. Actually if we closely examine CREATE INDEX statement, there is on option to specify the name of the database. So, by default, I assume, it creates INDEX subtable on same database where the table resides.
Enthusiast

Re: Global Temporary Tables and Secondary Index

The index is part of, and inseparable from, the materialized instance of the global temporary table. The space it uses is charged against the user's temporary space.