Enterprise Edition Home | Express Edition Home | Previous Page | Next Page   Data Manipulation > Using Smart Large Objects > Understanding Smart Large Objects >

Information About a Smart Large Object

The database server keeps the following information about a smart large object:

The database server stores this information in a metadata area of the sbspace for the smart large object.

Storage Characteristics

The storage characteristics tell the database server how to manage a smart large object in an sbspace. Three groups of information make up the storage characteristics for a smart large object:

You can specify storage characteristics at three points.

When Specified Method of Specification
When an sbspace is created Options of onspaces utility
When a database table is created Keywords in PUT clause of CREATE TABLE statement
When a smart large object is created DataBlade API functions

The following sections describe the three groups of storage characteristics. For additional information, see Choosing Storage Characteristics.

Disk-Storage Information

Disk-storage information helps the smart-large-object optimizer of the database server determine how to manage the smart large object most efficiently on disk. The smart-large-object optimizer manages the allocation of and access to smart large objects in an sbspace.

Each smart-large-object has the following disk-storage information:

The smart-large-object optimizer uses the disk-storage information to determine how best to size, allocate, and manage the extents of the sbspace. It can calculate all disk-storage information for a smart large object except the sbspace name.

Important:
For most applications, use the values that the smart-large-object optimizer calculates for the disk-storage information.

For special situations, you can set disk-storage information for a smart large object as part of its storage characteristics. For more information, see Choosing Storage Characteristics.

Attribute Information

Attribute information tells the database server what options, or attributes, to assign to the smart large object:

Logging

When a database performs logging, smart large objects might result in long transactions for the following reasons:

A simple workaround is to divide a long transaction into multiple smaller transactions. If this solution is not acceptable, you can control when the database server performs logging of smart large objects. Table 32 shows how you can control the logging behavior for a smart large object.

When logging is enabled, the database server logs changes to the user data of a smart large object. It performs this logging in accordance with the current database log mode. For a database that is not ANSI compliant, the database server does not guarantee that log records that pertain to smart large objects are flushed at transaction commit. However, the metadata is always restorable to an action-consistent state; that is, to a state that ensures no structural inconsistencies exist in the metadata (control information of the smart large object, such as reference counts).

American National Standards Institute

An ANSI-compliant database uses unbuffered logging. When smart-large-object logging is enabled, all log records (metadata and user-data) that pertain to smart large objects are flushed to the log at transaction commit. However, user data is not guaranteed to be flushed to its stable storage location at commit time.

End of American National Standards Institute

When logging is disabled, the database server does not log changes to user data even if the database server logs other database changes. However, the database server always logs changes to the metadata. Therefore, the database server can still restore the metadata to an action-consistent state.

Important:
Consider carefully whether to enable logging for a smart large object. The database server incurs considerable overhead to log smart large objects. You must also ensure that the system log file is large enough to hold the value of the smart large object. The logical-log size must exceed the total amount of data that the database server logs while the update transaction is active.

Write your DataBlade API modules so that any transactions with smart large objects that have potentially long updates do not cause other transactions to wait. Multiple transactions can access the same smart-large-object instance if the following conditions are satisfied:

The best update performance and fewest logical-log problems result when you disable the logging feature when you load a smart large object and re-enable it after the load operation completes. If logging is turned on, you might want to turn logging off before a bulk load and then perform a level-0 backup.

By default, the database server does not log the user data of a smart large object. You can control the logging behavior for a smart large object as part of its storage characteristics. For more information, see Choosing Storage Characteristics.

Last-Access Time

The last-access time of a smart large object is the system time at which the database server last read or wrote to the smart large object. The last-access time records access to the user data and metadata of a smart large object. The database server stores this system time as number of seconds since January 1, 1970, in the metadata area of the sbspace.

Tip:
The database server automatically tracks the last-change and last-modification time for a smart large object in the status information. For more information, see Status Information.

By default, the database server does not save the last access time. You can choose to track the last-access time for a smart large object as part of its storage characteristics. For more information, see Choosing Storage Characteristics.

Important:
Consider carefully whether to track last-access time for a smart large object. To maintain last-access times for smart large objects, the database server incurs considerable overhead in logging and concurrency.
Data Integrity

The structure of an sbpage in the sbspace determines how much data integrity the database server can provide. An sbpage is the unit of allocation for smart-large-object data, which is stored in the user-data area of an sbspace. The database server supports the following levels of data integrity:

The database server uses the page header and trailer to detect incomplete writes and data corruption. Moderate integrity provides the following benefits:

Moderate integrity might be useful for smart large objects that contain large amounts of audio or video data that is moved through the database server and that does not require a high data integrity. By default, the database server uses high integrity (page headers and page trailers) for sbspace pages. You can control the data integrity for a smart large object as part of its storage characteristics. For more information, see Choosing Storage Characteristics.

Important:
Consider carefully whether to use moderate integrity for sbpages of a smart large object. Although moderate integrity takes less disk space per page, it also reduces the ability of the database server to recover information if disk errors occur.

For information on the structure of sbspace pages, see your IBM Informix: Administrator's Guide.

Open-Mode Information

When you open a smart large object, you can specify the open mode for the data. The open mode describes the context in which the I/O operations on the smart large object are performed. It includes the following information:

The database server uses the following system default open mode when it opens a smart large object.

Open-Mode Information
Default Open Mode
Access mode
Read-only
Access method
Random
Buffering
Buffered access
Locking
Whole-object locks

If your smart large object usually requires certain access capabilities when it is opened, you can associate a default open mode with the smart large object. The database server stores this default open mode with other storage characteristics of the smart large object. For more information, see Choosing Storage Characteristics. To override the default open mode, you can specify an open mode for a particular smart large object when you open it. For more information, see Opening a Smart Large Object.

Access Modes

The smart-large-object open mode includes an access mode, which determines which read and write operations are valid on the open smart large object. Table 23 shows the access modes for a smart large object.

Table 23. Access Modes for Smart Large Objects
Access Mode Purpose
Read-only mode Only read operations are valid on the data.
Dirty-read mode You can read uncommitted data pages for the smart large object. No locks are requested on the data. You cannot write to a smart large object after you set the mode to MI_LO_DIRTY_READ. When you set this flag, you reset the current transaction isolation mode to dirty read for this smart large object.
Write-only mode Only write operations are valid on the data.
Write/append mode Any data you write is appended to the end of the smart large object. By itself, it is equivalent to write-only mode followed by a seek to the end of the smart large object. Read operations fail.

When you open a smart large object in write/append mode only, the smart large object is opened in write-only mode. Seek operations move the seek position, but read operations to the smart large object fail, and the LO seek position remains unchanged from its position just before the write. Write operations occur at the LO seek position, and then the seek position is moved.

Read/write mode Both read and write operations are valid on the data.
Truncate Delete any existing data in the smart large object and move the LO seek position to the start of the smart large object (byte 0). If the smart large object does not contain data, this access mode has no effect.
Access Methods

The smart-large-object open mode includes the access method, which determines whether to access the smart-large-object data sequentially or with random access. Table 24 shows the access methods for a smart large object.

Table 24. Access Methods for a Smart Large Object
Method of Access Purpose
Random access Indicates that I/O is random

When you plan to read in nonsequential locations in the smart large object, the smart-large-object optimizer should not read ahead a few pages.

Sequential access Indicates that reads are sequential in either forward or reverse direction

When you read a smart large object sequentially, the smart-large-object optimizer can read ahead a few pages.

Forward Indicates that the direction of sequential access is forward

If you do not specify a direction, the default is forward.

Reverse Indicates that the direction of sequential access is reverse

The default access method is random, although the smart-large-object optimizer might change this default based on a particular read pattern.

Buffering Modes

The smart-large-object open mode includes a buffering mode, which determines how read and write operations on the open smart large object are buffered. Table 25 shows the buffering modes for a smart large object.

Table 25. Buffering Modes for a Smart Large Object
Buffering Mode Purpose
Buffered access Indicates that I/O of the smart-large-object data goes through the buffer pool of the database server

This method of access is called buffered I/O. Buffered I/O tells the optimizer that someone might be planning to reread the same LO page.

Unbuffered access Indicates that I/O of the smart-large-object data does not use the buffer pool

This method of access is called lightweight I/O. lightweight I/O tells the smart-large-object optimizer to use private buffers instead of the buffer pool for these I/O operations. These private buffers are allocated out of the session pool of the database server. With lightweight I/O, you bypass the overhead of the buffer pool management when the database server performs a sequential scan.

Keep the following issues in mind when you use lightweight I/O:

Important:
In general, if read and write operations to the smart large objects are less than 8080 bytes, do not use lightweight I/O. In other words, if you are reading or writing short blocks of data, such as two kilobytes or four kilobytes, the default buffered I/O operations provide better performance.

The smart-large-object optimizer imposes the following restrictions when you switch from lightweight I/O to buffered I/O for a given smart large object:

These limitations ensure consistency of the smart-large-object buffers without imposing processing overhead for I/O operations.

If you do not specify a buffering mode, the default is buffered I/O. The smart-large-object optimizer determines the default buffering mode for a smart large object.

Locking Modes

To prevent simultaneous access to smart-large-object data, the smart-large-object optimizer obtains a lock on this data when you open the smart large object. This smart-large-object lock is distinct from the following kinds of locks:

The smart-large-object open mode includes a lock mode, which determines the kind of the lock requests made on a smart large object. Table 26 shows the lock modes that a smart large object can support.

Table 26. Lock Modes for a Smart Large Object
Lock Mode Purpose Description
Lock-all Lock the entire smart large object Indicates that lock requests apply to all data for the smart large object
Byte-range Lock only specified portions of the smart large object Indicates that lock requests apply only to the specified number of bytes of smart-large-object data

When the smart-large-object optimizer opens a smart large object, it uses the following information to determine the lock mode of the smart large object:

By default, the smart-large-object optimizer chooses the lock-all lock mode. You can request locks on the data of a smart large object at the byte level with a byte-range lock. For more information, see Accessing the Default Open Flag.

The smart-large-object optimizer retains the lock as follows:

When one of the preceding conditions occurs, the smart-large-object optimizer releases the lock on the smart large object.

Important:
You lose the lock at the end of a transaction even if the smart large object remains open. When the smart-large-object optimizer detects that a smart large object has no active lock, it automatically obtains a new lock when the first access occurs to the smart large object. The lock that it obtains is based on the original access mode of the smart large object.

The smart-large-object optimizer releases the lock when the current transaction terminates. However, the optimizer obtains the lock again when the next function that needs a lock executes. If this behavior is undesirable, use BEGIN WORK transaction blocks and place a COMMIT WORK or ROLLBACK WORK statement after the last statement that needs to use the lock.

Status Information

Table 27 shows the status information that the database server maintains for a smart large object.

Table 27. Status Information for a Smart Large Object
Status Information Description
Last-access time The time, in seconds, that the smart large object was last accessed

This value is available only if the last-access time attribute is enabled for the smart large object.

Storage characteristics The storage characteristics for the smart large object
Last-change time The time, in seconds, of the last change in status for the smart large object

A change in status includes changes to metadata and user data (data updates and changes to the number of references). This system time is stored as number of seconds since January 1, 1970.

Last-modification time The time, in seconds, that the smart large object was last modified

A modification includes only changes to user data (data updates). This system time is stored as number of seconds since January 1, 1970.

On some platforms, the last-modification time might also have a microseconds component, which can be obtained separately from the seconds component.

Reference count The number of references (LO handles) to the smart large object
Size The size, in bytes, of the smart large object

The database server stores the status information in the metadata area of the sbspace.

Tip:
The time values (such as last-access time and last-change time) might differ slightly from the system time. This difference is due to the algorithm that the database server uses to obtain the time from the operating system.

For more information on how to obtain status information in a DataBlade API module, see Obtaining Status Information for a Smart Large Object.

Enterprise Edition Home | Express Edition Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]