# Estimating pages that simple large objects occupy

You can estimate the total number of pages for all simple large objects, or you can estimate the number of pages based on the median size of the simple large objects.

The blobpages can reside in either the dbspace where the table resides or in a blobspace. For more information about when to use a blobspace, see Storing simple large objects in the tblspace or a separate blobspace.

The following methods for estimating blobpages yield a conservative (high) estimate because a single TEXT or BYTE column does not necessarily occupy the entire blobpage within a tblspace. In other words, a blobpage in a tblspace can contain multiple TEXT or BYTE columns.

To estimate the number of blobpages:

1. Obtain the page size with onstat -b.
2. Calculate the usable portion of the blobpage with the following formula:
``bpuse = pagesize - 32``
3. For each byte of blobsize n, calculate the number of pages that the byte occupies (bpages_n) with the following formula:
``````bpages1 = ceiling(bytesize1/bpuse)
bpages2 = ceiling(bytesize2/bpuse)
...
bpages_n = ceiling(bytesize_n/bpuse)``````

The ceiling() function indicates that you should round up to the nearest integer value.

4. Add up the total number of pages for all simple large objects, as follows:
``blobpages = bpages1 + bpages2 + ... + bpagesn ``

Alternatively, you can base your estimate on the median size of simple large objects (TEXT or BYTE data); that is, the simple-large-object data size that occurs most frequently. This method is less precise, but it is easier to calculate.

To estimate the number of blobpages based on the median size of simple large objects:

1. Calculate the number of pages required for simple large objects of median size, as follows:
``mpages = ceiling(mblobsize/bpuse)``
2. Multiply this amount by the total number of simple large objects, as follows:
``blobpages = blobcount * mpages ``