SQL Server Performance Analysis-view the table data page

Source: Internet
Author: User
Returns the table name, index name, and number of rows.
Select object_name (I. object_id) as objectname, I. [name] As indexname, sum (P. Rows) as rowcnt
From SYS. Indexes I
Inner join SYS. partitions P
On I. object_id = P. object_id
And I. index_id = P. index_id
Where I. object_id = object_id ('dbo. Meeting ')
And I. index_id <= 1
Group by I. object_id, I. index_id, I. [name]

Returns the total number of pages, number of pages used, and number of data pages of the table.
Select object_name (I. object_id) as objectname, I. [name] As indexname,
Sum (A. total_pages) as totalpages, sum (A. used_pages) as usedpages, sum (A. data_pages) as datapages,
(Sum (A. total_pages) * 8)/1024 as totalspacemb, (sum (A. used_pages) * 8)/1024 as usedspacemb,
(Sum (A. data_pages) * 8)/1024 as dataspacemb
From SYS. Indexes I
Inner join SYS. partitions P
On I. object_id = P. object_id
And I. index_id = P. index_id
Inner join SYS. allocation_units
On P. partition_id = A. container_id
Where I. object_id = object_id ('dbo. Meeting ')
And I. index_id <= 1
Group by I. object_id, I. index_id, I. [name]

Statistics by PAGE type
Select case when grouping (I. object_id) = 1 then '--- total --- 'else object_name (I. object_id) end as objectname,
Case when grouping (I. [name]) = 1 then '--- total --- 'else I. [name] end as indexname,
Case when grouping (A. type_desc) = 1 then '--- total --- 'else A. type_desc end as pagetype,
Sum (A. total_pages) as totalpages, sum (A. used_pages) as usedpages, sum (A. data_pages) as datapages,
(Sum (. total_pages) * 8)/1024 as totalspacemb, (sum (. used_pages) * 8)/1024 as usedspacemb, (sum (. data_pages) × 8)/1024 as dataspacemb
From SYS. Indexes I
Inner join SYS. partitions P
On I. object_id = P. object_id
And I. index_id = P. index_id
Inner join SYS. allocation_units
On P. partition_id = A. container_id
Where I. object_id = object_id ('dbo. Meeting ')
And I. index_id <= 1
Group by I. object_id, I. [name], A. type_desc with Rollup

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.