Internal Algorithms [ ALLBASE/SQL Performance Guidelines ] MPE/iX 5.0 Documentation
ALLBASE/SQL Performance Guidelines
Internal Algorithms
When the editor starts, it opens a file called the scroll file. It also
allocates a 12K data buffer.
SELECT
When a SELECT is executed, the editor pulls in data from the table with
BULK FETCH statements, 12K bytes at a time. If more than one BULK FETCH
is needed, it appends the data from the previous FETCH to the scroll
file. After the last FETCH in a sequence of FETCH statements, the data
is appended to the scroll file, and the first 12K of data is read back
into the data buffer. If all the data fits in the buffer, the scroll
file is not used at all. Before control returns to the user, the
transaction is ended.
The window pointer is then set to the first row in the buffer, and the
first set of rows is displayed. Cursor positioning and page scrolling,
since they are handled completely by the editor without accessing the
database, are very fast.
DELETE
When a DELETE is executed, the tuple is fetched from the table based on
its old primary key value. If the tuple is not found, then the following
message is returned:
Tuple Does Not Exist
The row is marked as deleted in the memory buffer, and the table is
redisplayed starting from the window pointer. All rows marked as deleted
are skipped by the display manager.
If the tuple to be deleted is still found in the table, it is compared
against the old value of the tuple. If they are identical, the tuple is
deleted from the table, the row is marked as deleted in the memory
buffer, and the table is redisplayed starting from the window pointer.
If the tuple in the database has changed, then the following message is
returned:
Tuple Has Changed
The tuple's value in the buffer is updated, and the table is redisplayed
starting from the window pointer.
In all three cases, the transaction is ended before control returns to
the user. Locks are obtained and released before additional terminal I/O
is requested.
UPDATE
When an UPDATE is executed, the tuple is fetched from the table based on
its old primary key value. If the tuple is not found, then the following
message is returned:
Tuple Does Not Exist
The row is marked as deleted in the memory buffer, and the table is
redisplayed starting from the window pointer.
If the tuple is found, it is compared against the old value of the tuple.
If they are identical, the tuple is updated, the tuple's value in the
buffer is updated, and the table is redisplayed starting from the window
buffer.
If the tuple in the database has changed, then the following message is
returned:
Tuple Has Changed
The tuple's value in the buffer is updated, and the table is redisplayed
starting from the window pointer.
In all three cases, the transaction is ended before control returns to
the user.
CAUTION A dirty bit is kept for the whole data buffer. The bit is set
when the contents of the buffer is modified (that is, becomes
"dirty"). If set, the current contents have to be written to
the scroll file before a new 12K block is read from it.
MPE/iX 5.0 Documentation