Você está na página 1de 10

Chapter 4 Teradata Space

How Permanent Space is calculated

"No one is so generous as he who has nothing to give."


French Proverb
If you dont have any perm you are at the Merci of the DBA. There are three types of space in Teradata and they are Perm, Spool, and Temp. It all starts with Perm Space. Users will most likely not have any Perm space because Perm is for Permanent tables, secondary indexes, and the Permanent Journals. If a user is given Perm space it is not allocated immediately, but is an upper limit of space for their tables. Teradata permanent space is calculated by adding up all the available space on an AMPs attached disks and that is the size of your Teradata warehouse. When a system is delivered the user DBC owns all the Permanent Space. It is important to remember that Teradata was born to be parallel so Teradata always calculates all space on a per AMP basis. In the pictures below we see that the original system was 100 Gigabytes. DBC owned all 100 Gigabytes. Since there are four AMPs then we actually calculate the space as 25 Gigabytes per AMP.

How Permanent Space is Given

"The Constitution only gives people the right to pursue happiness. You have to catch it yourself."
Ben Franklin
The Teradata Constitution states, "We the Users, in order to form a more perfect UNION, or INTERSECT, establish SQL as the holder of Truths to be self joined, that all users are created equal, EXCEPT power users, with certain unalienable Access Rights, that among these SELECTed are Life, Liberty, and the Pursuit of Managements Happiness". The real truth is that when a system is delivered the user DBC owns all the Permanent Space so forget about "We the People". DBC sits on top of the hierarchy. It is up to DBC to give up some of its Perm Space to others so it is "Ye the DBC". Until this system changes size there will always be 100 Gigabytes of PERM Space. It will merely be owned by multiple users or databases. Permanent space defines the upper limit of space and it is not allocated at Table Create time.

The Teradata Hierarchy

"In the end well remember not the words of our enemies, but the silence of our friends."
Martin Luther King, Jr.
One of the greatest human beings of all-time in our opinion was Dr. Martin Luther King, Jr. who had a dream. Teradata has a dream that all users can be judged not by the color of their skin, but by the characters in their SQL. Teradata is hierarchical in nature. Anyone above you in the hierarchy is your parent or owner. Anyone below you is your child. The key point is that anytime you give away some of your Permanent Space you lose it until the child is dropped or gives it back. It is like money. If you give it away you have less in your account. Give it all away and you are broke! Also notice that the total Permanent Space in the system below is still 100 Gigabytes. Permanent Space is where objects (i.e., databases, users, tables) are created and stored. Permanent Space is released when data is deleted or when objects are dropped. Permanent space defines the upper limit of space for a database or user.

How Spool Space is calculated

"Its not the size of the dog in the fight, but the size of the fight in the dog."
Archie Griffin
Spool space is a wonderful thing unless the query goes to Hies-man! Each user who runs queries is allocated a certain amount of Spool Space for the query answer set. If your answer set runs past its spool limit the query is aborted. Some users logon twice thinking they can trick the system, but spool is calculated on a user basis and once you are over you are stopped at the goal line. Running out of spool space makes users mad dog mean. Spool space is literally unused permanent space. Spool space is system wide so anywhere there is empty PERM space it can be used for spool. It is important to remember that Teradata was born to be parallel so Teradata always calculates all space on a per AMP basis. The difference in how you calculate PERM Space is radically different than Spool Space. PERM Space always totals the total space available in the system. Each database or user might own a portion of the space, but what counts is whether or not the space has been filled with Tables, Secondary Index subtables or Permanent Journals. Spool and Temp space are nothing more than unused PERM. If tables are not filling the disks then users can utilize this empty space for their Spool and Temp space. A user will run out of spool space if they exceed their limit on a per AMP basis.

A Spool Space Example

"Speak in a moment of anger and youll deliver the greatest speech youll ever regret."

Anonymous
When you are angry hold your tongue and keep your cool. When your query aborts hold your tongue and raise your spool. It is important to remember that Teradata was born to be parallel so Teradata always calculates all space on a per AMP basis. The difference in how you calculate PERM Space is radically different than Spool Space. PERM Space always totals the total space available in the system. The total amount of spool space is whatever is left over from PERM once the tables have been loaded. Remember, that if you totaled everyones spool it could be a thousand times more then the total perm. This is because it is assumed not everyone will be logged on at the same time. In our example below we have 3 users in MRKT. Each could be assigned the maximum amount of Spool Space that MRKT is assigned and that is 20GB. Each could run their queries simultaneously and all could be just under 20GB and the system would not care. Spool space is an upper limit for your query answer sets. You dont add or subtract when you are giving someone else spool. The total amount of spool in the system will always exceed the actual Perm space. There are two times you run out of Spool Space. When the system is completely out of free space or when your query exceeds its spool limit.

How much spool space can be assigned to the users in MRKT? Could they each run a query simultaneously that reached 19.5 Gigabytes of spool? Yes!

PERM, SPOOL and TEMP Space

"Every sunrise is a second chance."


Unknown

There is a tribe in Africa that awakes during darkness and prays for the sun to come up. They have been doing so for thousands of years and every day their prayers are answered. We all owe them a debt of gratitude because every sunrise is a second chance. There are times when you might feel down, but dont forget to give yourself a second chance. Teradata will always give you another chance if you run out of Perm, Spool or Temp. A user or database is assigned at least two types of space. They are Permanent Space and Spool Space. PERM space is used to store tables and most users wont get any Perm. Perm Space is the upper limit of space assigned to a user in their user definition and it is managed and maintained by Teradata. SPOOL space is for users to run their queries and every user gets Spool. If your query exceeds your allocated Spool space you will need a second chance because your query is immediately aborted. For users who want to utilize Global Temporary Tables another space is used and it is called TEMP space. A user who is assigned no Permanent Space cant create tables in their user space. They could however create a view, macro, or trigger because these objects dont use Perm space.

Spool Space controls system time

"Danger Will Robinson Danger!"


-Robot on 1960s TV Show "Lost in Space"
Permanent Space and Spool space were designed to control how data warehouse space is allocated and how long a users query can run. Spool space limits are designed to handle run away queries and control how much time a users query can run before it is deemed "Hogging the system". When a query is run the result set is produced on the AMPs disk in a Spool file until it is ready to be transmitted over the BYNET to the PE which then passes the answer to the user. If a user exceeds their MaxSpool limit by one byte the query is immediately aborted. Not every user has the same amount of spool space. Power users are often given more spool then

someone who is a new user. MaxSpool limits the number of bytes Teradata will allocate for a users spool files, which also prevents runaway queries from taking too much system resources.

"Danger Your Query has exceeded its limit and will be aborted before it does some ROBBING SON!"
-Abort Button of 1507s TV Show "Lost in Spool Space"
Spool Space comes from PERM space that has not been allocated. Spool space is unused PERM. The primary reason to have SPOOL space available is to store intermediate and final results of queries that are being processed in Teradata. Spool Space is released when the query is over or when the query no longer needs it. Spool space is Permanent Space that is not currently being used. Temporary Space is Permanent Space that is not currently being used. Some users may be assigned Temporary Space which defines the upper limit of space that the user can utilize in Global Volatile tables.

Spool Reserve

"When all you have is a hammer, you tend to see every problem as a nail."
- Abraham Maslow
Having the right tools can help do a job. Each man has but one woman, but the iceman has his pick. The barber has many different styles, but the DBA has their perm. Sometimes your Teradata system can run low on both Perm and Spool space. Here is a neat trick to solve both problems. Let me give you two scenarios and solve both with the same technique. Imagine that the system is adding users and management is not sure that there will be enough spool space. Also imagine that many new departments are becoming part of the data warehouse and perm space is being handed out quickly. The DBA can be a hero by dedicating 20% of the entire system space to a database or user. As a standard they will often call the database or user Spool_Reserve. Spool_Reserve is Perm Space and the DBA does not put any tables inside Spool_Reserve. This solves both problems. Spool is nothing more then unused Perm. Since Spool_Reserve is empty then users can utilize it for spool space and the DBA knows they always have an additional 20% of system space that can be used for more Perm if necessary. So remember the golden parachute rule of reserving 20% of the total user space as Perm so it can be reserved for Spool.

A quiz on Perm and Spool Space

MRKT starts with 10,000,000 bytes of Perm and 10,000,000 bytes of Spool SALES starts with 5,000,000 bytes of Perm and 5,000,000 bytes of Spool Steve and Mandy are then created with 1,000,000 bytes of Perm and 10,000,000 bytes of spool each

Another quiz on Perm and Spool Space

A system has 200 Gigabytes of Space and User A is assigned 60 Gigabytes of permanent space. User A gives User B 40 Gigabytes of permanent space. How much space will User A have left? 20 Gigabytes A system has 200 Gigabytes of permanent space in the system. 100 Gigabytes is reserved for spool. The system currently has 60 Gigabytes of user data. How much could be left for spool? 140 Gigabytes

Você também pode gostar