Query to find Table Space Utilization in Database

This is the query to find the amount of space which each table occupy in there respective Database.


SELECT
DATABASENAME (TITLE ‘Database’)
,TABLENAME (TITLE ‘Table Name’)
,SUM(CURRENTPERM)/(1024*1024*1024)Ā  (DECIMAL(15,6))Ā  (TITLE ‘Current Perm Space(GB)’)
FROM DBC.TABLESIZE
WHERE DATABASENAME = ‘YOUR_DATABASE_NAME
GROUP BY 1,2
ORDER BY 3 DESC

Where YOUR_DATABASE_NAME is the name of the database for which u need to do the analysis.

This Query will return 3 columns Database, Table Name and Current Perm Space(GB).Based on the analysis of these data we can easily see that how much space each table is occupying in the database.


18 comments

Skip to comment form

  1. I’ve tested cashtornadoapp and I have to say that this stuff blew my mind. I can’t have enough of this, I just can’t stop keep playing cashtornadoapp

  2. Lucky47pkrgame’s actually been treating me pretty well. Good vibes and a pretty cool community. Try it out, you might get lucky yourself: lucky47pkrgame

  3. Spent a few hours on wc99game last night. Graphics are good and gameplay is engaging. A fun way to wind down after work. Definitely give it a shot. wc99game

    • satish on May 4, 2017 at 5:00 am
    • Reply

    Hi Raj,

    Can you please give me a query for transpose columns to rows and rows to columns?

      • Pratibha Verma on May 14, 2019 at 2:56 pm
      • Reply

      Use Union to transpose column to rows and rows to column.

    • Melony on September 4, 2013 at 6:16 pm
    • Reply

    Thank you for the excellent query!!!!!!

    Melony
    Database Analyst

  4. I have eight tables in one schema say “S1″…in teradata DB…each eight table having a unique column say ‘UC’.

    Now i want to display all the available tablename whose column ‘UC’ value having character value ‘P’ and if not then do’t display the respective tablename??

    • venkat on October 25, 2011 at 4:50 am
    • Reply

    Hi,

    This is site one of very good site which i had seen.
    thank you so much for providing such valuable information

    • gaurav sharma on October 21, 2011 at 1:25 pm
    • Reply

    really nice site.. very good contents. THANKS

    1. Thanks for appreciation

  5. Excellent Help.
    Thanks šŸ™‚

      • admin on September 17, 2011 at 12:47 pm
        Author
      • Reply

      Your Welcome šŸ™‚

    • munna on July 18, 2011 at 11:24 am
    • Reply

    an excellent site to learn any thing about teradata

    1. Thanks Munna šŸ™‚

      i appreciate if you also give your feedback for the improvement of the site

        • munna on July 18, 2011 at 12:05 pm
        • Reply

        sure…..iam planning for certifications..iam reading the materials your are provided as PDF in this site..but i dont have any planned way to achieve those certifications….can you provide some informations on the posts…so that every one will get benefited…

        1. Go to this link –

          http://www.teradatatech.com/?p=62

          for complete knowledge about Teradata certifications.

          Initially you have to clear Basics and SQL certificate , to move to another level.

          I suggest to go through Teradata Users Guide by COFFINGS and also refer WBT material from Teradata site itself.

          For practice question on both these certifications you can refer –
          http://www.teradatatech.com/?p=325
          http://www.teradatatech.com/?cat=5

    • Eulah on July 16, 2011 at 2:15 pm
    • Reply

    Greetings I located your site by mistake when i searched Live search for this concern, I have to say your site is really useful I also love the layout, it is good!

    1. Thanks …. i must say some mistakes are good šŸ™‚

Leave a Reply to Suraj Cancel reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.