sybase - how to select max top 10 (n) rows with there size? -


i have below query gets size of tables. intersted top 10 max size table there size.

how ?

select convert(varchar(30),o.name) table_name, row_count(db_id(), o.id) row_count, data_pages(db_id(), o.id, 0) pages, data_pages(db_id(), o.id, 0) * (@@maxpagesize/1024) kbs sysobjects o type = 'u' order table_name 

searching similar: select top 10 max(datapages) sysobjects

edit:

also have size of indexes, adding sysindexes query enough or should add system table syscoments ?

writing such way giving me top table name:

select top 10 convert(varchar(30),o.name) table_name, row_count(db_id(), o.id) row_count, data_pages(db_id(), o.id, 0) pages, data_pages(db_id(), o.id, 0) * (@@maxpagesize/1024) kbs sysobjects o type = 'u' order table_name , kbs 

this throwing error

select top 10 data_pages(db_id(), o.id, 0) * (@@maxpagesize/1024) kbs , convert(varchar(30),o.name) table_name, row_count(db_id(), o.id) row_count, data_pages(db_id(), o.id, 0) pages sysobjects o type = 'u' order  kbs , table_name  

this query works on ase 16.0 system:

select top 10 convert(varchar(30),o.name) table_name, row_count(db_id(), o.id) row_count, data_pages(db_id(), o.id, 0) pages, data_pages(db_id(), o.id, 0) * (@@maxpagesize/1024) kbs sysobjects o type = 'u' order kbs desc, table_name asc 

Comments

Popular posts from this blog

yii2 - Yii 2 Running a Cron in the basic template -

asp.net - 'System.Web.HttpContext' does not contain a definition for 'GetOwinContext' Mystery -

mercurial graft feature, can it copy? -