Use a WD index for the fastest access to columns that contain a list of keywords (for example, in bibliographic record or Web page).
The following restrictions apply to WD:
You cannot specify the UNIQUE attribute.
The WD index is used only with the CONTAINS or LIKE predicate.
The column-name must identify a CHAR, VARCHAR, or LONG VARCHAR column in a base table.
The minimum permitted column width is 3 bytes and the maximum permitted column width is the maximum width for a LOB column. (The maximum length is equal to 4GB multiplied by the database page size.)
You must enclose the list of delimiters in single quotes. The Sybase Central Create Index wizard does not indicate this when it prompts for delimiter characters, and returns an error if you omit them.
If the DELIMITED BY clause is omitted or the separators-string value specified is the empty string (single quotes), then Sybase IQ uses the default set of separators. The default set of characters includes all 7-bit ASCII characters that are not 7-bit ASCII alphanumeric characters, except for the hyphen and the single quotation mark, which are part of words by default. There are 64 separators in the default separator set.
If multiple DELIMITED BY and LIMIT clauses are specified, no error is returned, but only the last clause of each type is used. For example, the following two statements return identical results:
Statement 1:
CREATE WD INDEX c1wd on foo(c1) DELIMITED BY 'f' LIMIT 40 LIMIT 99 DELIMITED BY 'g' DELIMITED BY 'h';
Statement 2:
CREATE WD INDEX c1wd on foo(c1) DELIMITED BY 'h' LIMIT 99;
After a WD index is created, any insertions into its column are parsed using the separators and maximum word size cannot be changed after the index is created.
For CHAR columns, Sybase recommends that you specify a space as at least one of the separators or use the default separator set. Sybase IQ automatically pads CHAR columns to the maximum column width. If your column contains blanks in addition to the character data, queries on WD indexed data may return misleading results. For example, column company_name contains two words delimited by a separator, but the second word is blank padded:
'Concord' 'Farms '
Suppose that a user entered the following query:
SELECT COUNT(*)FROM Customers WHERE CompanyName contains ('Farms')
The parser determines that the string contains:
'Farms '
instead of:
'Farms'
and returns 1. You can avoid this problem by using VARCHAR instead of CHAR columns.
The sp_iqcheckdb (DBCC consistency checker) allocation, check, verify, and repair modes support the WD index on CHAR, VARCHAR, and LONG VARCHAR columns.