Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

View vs volatile table?

Tags:

teradata

What is the difference between a view and a volatile table in Teradata? As far as I know, a volatile table is removed with the end of the session. Also it is only me who can see the volatile table as opposed to the view. Are there any other significant differences?

like image 444
Azamat Bagatov Avatar asked Oct 29 '13 13:10

Azamat Bagatov


2 Answers

A volatile table is a temporary table that is only held until the end of session. This is created by default in your "personal schema" and consumes your spool space to maintain.

A view is an object that is permanent across sessions, generates from tables existing in the environment you are in, and does not consume spool space continuously.

Generally speaking I use volatile tables to upload from scripts so that I can process information and drop table easily at the end of a session. I use views to change the way a user sees information that resides in other tables or to restrict access to information to certain users without altering root tables.

like image 149
DrBailey Avatar answered Nov 08 '22 23:11

DrBailey


A volatile table stores the data physically. You can access that data multiple times during your session. With a View the data is collected every time you access it.

To help speed up queries on views, you can use Join Indexes on Teradata. They physically store the results of a certain select and maintain it when the underlying data is changed (insert, update, delete) automatically - like most of things on a Teradata.

like image 38
jboi Avatar answered Nov 08 '22 21:11

jboi