2016-08-19

Pages in Sybase / SAP ASE: Virtual and Logical pages

In many places, where command do something with disk or database, you can specify page size. There is also mentioned that default size of the page is 2KB, but this can be set to 4KB, 8KB and so on...
Generally we have two types of pages that can be described by parameters of some commands. There are:

  • Virtual pages
  • Logical pages
Virtual pages are defined "near" the disk. Virtual page is always 2KB. Parameters that expect amount of virtual pages can be simple recomputed to easier to understand size in MB. You need simple to multiply number of MB with 512 (as 1 MB has 512*2KB pages).

Logical pages are defined "near" database objects. Here you are responsible for defining the size of the page. They can have size of 2, 4, 8 or 16 KB. Having those pages defined as 4KB means that each database object like index or table will take at least 4KB. If it is greater than 4KB a new page will be added to for the object and it will take 8KB, even if the second page is mostly empty. When the second page fills up, next page will be allocated for the object, that will occupy 12 KB now, and so on... If you plan to have huge objects in the database, having bigger page size is beneficial. On the other hand, if the database should contain a large amount of smaller objects it may be better to have smaller logical page size.

IO operations are done on 512KB allocation units, that bind together 256 logical pages of 2KB each. The sizes of virtual pages, size of allocation units is constant, so you need to play with those values only when trying to get size in MB instead in number of pages and vice versa.

Let's analyze when a lot of small objects should be created in the database. When new space is allocated to the database it is done in 256 pages steps. If we are using 4KB pages than when our database grows, the smaller increase will be 4KB*256=1MB. If the logical page size for the database would be 16KB, the increase will be calculates as 16KB*256=4MB.So having smaller page size for smaller objects may work better.



No comments:

Post a Comment

SAP Adaprive Server Enterprise

SAP Adaprive Server Enterprise
SAP Adaprive Server Enterprise