1. A method for use in a database system having at least one processor, comprising: creating a user-defined routine in the database system; selectively setting an indicator to have one of plural values; representing a predicate expression invoking the user-defined routine with one of plural types of data structures based on the value of the indicator; and selecting, by an optimizer executed on at least one processor in the database system, whether or not to use indexing and statistics in a query plan for a query containing the predicate expression based on determining which of the plural types of data structures is used to represent the predicate expression invoking the user-defined routine.