Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Need to know the size of my table

Former Member
0 Kudos

dear all,

I was able to figure out that there are millions of records in my table (cluster table) by writing a short program and running it in the background. But is there a way to determine the size of the table in kbs.Example: I know i have 73 million records in my table and there are 300 fields, is there a way to ascertain the size of the table in KBs. DB02 doesnt show this information for cluster tables.

Please let me know if there is a way to determine that.

thank,

Krrish

1 ACCEPTED SOLUTION

former_member222860
Active Contributor
0 Kudos

Hi Krrish,

If u wanted to see the size of the table, just place 'write' after the code i had given

like this:

write:/ size-kb.

Sorry, i had not seen ur reply.

If it works, pl close the thread

thanks\

Mahesh

9 REPLIES 9

former_member222860
Active Contributor
0 Kudos

Hi,

You can use this Native Sql statement, it gives the actual table size.

DATA: BEGIN OF SIZE OCCURS 0,

KB LIKE SEGMENTS_S-KBYTES,

END OF SIZE.

EXEC SQL.

SELECT SUM(BYTES)/1024 FROM DBA_SEGMENTS WHERE

SEGMENT_NAME = :TABNAME

INTO :SIZE

ENDEXEC.

thanks

Mahesh

0 Kudos

Hello Mahesh,

I have used the program you suggested in SE38 and this is what it looks like:

DATA: BEGIN OF SIZE OCCURS 0,

KB LIKE SEGMENTS_S-KBYTES,

END OF SIZE.

EXEC SQL.

SELECT SUM(BYTES)/1024 FROM DBA_SEGMENTS WHERE

SEGMENT_NAME = :'BSEG'

INTO :SIZE

ENDEXEC.

But for some reason when i hit direct processing or execute it doesnt do a thing. Where should i see the result.

Do i need to run this in the background and if so where can i see the output, please provide me the additional codeing, if i run it in the background and need to see the output.

Thanks,

0 Kudos

Anyone ???????

Former Member
0 Kudos

Hi

[https://forums.sdn.sap.com/click.jspa?searchID=19733724&messageID=6420846]

Former Member
0 Kudos

Try using transaction DB02.

former_member223537
Active Contributor
0 Kudos
DATA: BEGIN OF SIZE OCCURS 0,
KB LIKE SEGMENTS_S-KBYTES,
END OF SIZE.

EXEC SQL.
SELECT SUM(BYTES)/1024 FROM DBA_SEGMENTS WHERE
SEGMENT_NAME = :'BSEG'
INTO :SIZE

ENDEXEC.

WRITE 😕 'SIZE:', SIZE.  " TO display the result

Add the above line & then execute the program.

0 Kudos

I get a message ' "SIZE" cannot be converted to a character-type field'

former_member222860
Active Contributor
0 Kudos

Hi Krrish,

If u wanted to see the size of the table, just place 'write' after the code i had given

like this:

write:/ size-kb.

Sorry, i had not seen ur reply.

If it works, pl close the thread

thanks\

Mahesh