Let’s start with frequently asked questions from newbies about this topic.
Q: What is Size Category?
The size category is basically our “estimation” on how many records database table which we are creating is going to contain.
Of course, nobody knows the exact number. That’s why we want to shoot our best ;).
Q: Why estimate Size Category?
When creating a database table, we need to let SAP know how much space needs to be allocated physically on database storage. By providing Size Category we help the database to allocate enough of space.
Q: What happens if the database table exceeds the number of records?
It’s not a problem. The database will just create another tablespace with the same Size Category.
Q: Isn’t it then the best thing to do to use Size Category “0” everywhere?
No! What would happen then is that each and every time database records exceed the Size Category number, it creates another tablespace in the very next empty space in the database. And this results into having lots of fragments, which means that processing the data in the database is much slower.
Q: Then we should rather use as high Size Category as possible everywhere, right?
No! Then we just waste the resources when creating big tablespace where nothing will be stored.
Q: Where to set up the Size Category?
We set up the Size Category while creating Database Table within Technical Settings (click here to read more).
That’s why we use the word “estimate”, where we give our best “guess” and this way help database to optimize the tablespace allocation, because only we as developers know how many records we can approximately expect.
.. and if you want to know more, here is something about the theory.
Size Category in SAP defines the expected space required for the table in the database initially and if the initial space is not enough, the same amount of space is reallocated when required. Each category has assigned a certain fixed memory size in the database, which depends on the database system used.
There are 9 Size Categories, from 0-9. The higher the number, the bigger the allocation space. The image above shows estimation records for each Size Category.