1.5 Counter data type, other types

The counter data type serves two purposes. One is to generate a unique value for a record, a surrogate primary key. The second is to act as a timestamp, as the counter encodes the time it was created, and can be compared against times, and will sort into creation order. Requires locking enabled to generate unique values. If the clock is set back, then counters will still ensure unique values, however the date during the overlap period will be set to ensure that the insertion sequence ordering is maintained.

The varchar datatype handles textual data within the database record. Contrary to most databases a varchar field can hold as much data as you want, and is not limited to the size initially given. The initial size is used as a suggestion to handle the data internally, as well as storing the field in compound indexes.

The indirect datatype holds a filename, and when performing text-search operations the contents of the file is looked at, rather than the filename. The filename is used for non text-search operations such as '=', 'matches' etc. It is useful if you have large amounts of text to index, and want to keep the table small, either due to other uses for the files,

The blob datatype can also contain large text information. It has some of the advantages of indirects, without some of the disadvantages. Blob fields store the text in a separate file from the rest of the record. All blobs associated with a table share a single file. This allows for faster access to the records in the table, due to the smaller size, while still allowing reasonable access times to the text data if the contents does need to be accessed.

Post-searching should be kept to a minimum, but will be a much bigger problem with indirects, as it needs to open and read the file to do the post search. Blobs also incur the penalty of extra IO when post-processing, but it is much less as the file will already be open.

Strlst allows a list of strings to be stored in a single field. When converting a string to a list of strings, the last character in the string is taken as the separator. For example: 'a,b,c,' converted to strlst will give a list with three members, 'a', 'b', and 'c'. When compared against a string with '=' or 'matches' each individual item is compared, so the above example would compare equal to 'b'.

Back: Ordering data for performance Next: Database security
Copyright © 2024 Thunderstone Software LLC. All rights reserved.