In-Memory Database Guide : Calculating the maximum BLOB size : Calculating the space available for BLOB data
  
Calculating the space available for BLOB data
The algorithm for calculating the space available for BLOBs is approximate. Make a copy of the table below, then fill it in with the values appropriate for your table. Follow the steps to calculate the remaining space available for BLOB data.
Step
Value
What to enter in Value
What the Value means
1
 
In the space to the left, enter either your block size or 32767 (whichever is smaller). The block size will be either the value that you set in the [IndexFile] BlockSize solid.ini configuration file, or the default documented in the solidDB® Administrator Guide.
The block size (page size) is the number of bytes in a “block”, analogous to a disk block. Since each row must fit within a block, this represents the maximum size of a row.
2
17
Use the hardcoded value shown to the left.
The number of bytes of overhead per page.
3
10
Use the hardcoded value shown to the left.
The number of bytes of overhead per row. We assume that you have only 1 row per page if you have large BLOBs.
4
 
If you have declared an explicit primary key for your table, enter the value 10. Otherwise, enter 20.
Represents bytes used for columns that the server automatically adds to each table.
5
 
Enter the number of columns in your table, multiplied by 2.
The number of bytes of overhead for the columns.
6
 
Enter the sum of the sizes of the fixed-size columns of data in your table. (See the table below for the size of each fixed-size data type.)
Represents space taken up by fixed-size columns.
7
 
Enter the number of BLOB columns.
The number of bytes used to terminate BLOB values (1 byte per value).
8
 
Sum the values in rows 2 through 7.
The total space used by everything except the BLOB values.
9
 
Subtract row 8 from row 1.
The approximate number of bytes available for BLOB data. If you have a single BLOB column in your table, then this is the approximate maximum size of that BLOB value.
Note The maximum block size is 64K; however, the maximum row size (and thus the maximum BLOB size) is only 32K (actually 32K-1, or 32767). If your block size is 64K or 32K, enter 32767 instead of the block size in row 1 of the table.
The table below indicates the number of bytes required to store a value of each fixed-size data type. For example, it takes 8 bytes to store a value of type SQL FLOAT.
Data type
Storage size (in bytes)
TINYINT
1
SMALLINT
2
INT
4
BIGINT
8
DATE/TIME/TIMESTAMP
11
FLOAT / DOUBLE PRECISION
8
REAL
4
NUMERIC / DECIMAL
11
CHAR / VARCHAR / LONG VARCHAR
char_length(column_value) + 1
WCHAR / WVARCHAR / LONG WVARCHAR
char_length(column_value) * 2 + 1
BINARY / VARBINARY / LONG VARBINARY
octet_length(column_value) + 1
 
See also
Calculating the maximum BLOB size