Function Usage on Index Columns
When using date and time functions on primary key or secondary index columns in a WHERE clause or table iterator filter string, the application of the function to the column, in the left side of an equation, does not reduce the number of rows being examined for a query. Indexes are calculated based on the actual value of a column and not the value that is the result of conversion by functions.
You can use the date and time functions in comparisons with key or index fields and still get the benefit of the key or index, if you use the function on the right-hand side of the equation. For example if the
dtm column is of type
datetime (holds
tibDateTime objects) and
dtm is defined as a secondary index, the following query only scans those rows with a date less than '2018-06-01 00:00:00':
SELECT * FROM mytable WHERE dtm < datetime('2018-06-01')
Copyright © Cloud Software Group, Inc. All rights reserved.