skip to main content
Schema definition and management : Filtering schema objects based on the search object : Optimizing for tables with large number of columns
 

Optimizing for tables with large number of columns

Returning all columns of a table for a schema request for DAMOBJ_TYPE_COLUMN is not efficient when a table has large number of columns and the query is only selecting a small sub-set of them. The IP can configure the schema request for columns to occur one column at a time. In this configuration, the IP is asked only for columns that are referenced in the query.
The IP must be designed to mark support for IP_SUPPORT_VALIDATE_SCHEMAOBJECTS_IN_USE.
The IP Schema does not require any specific changes. It efficiently returns specific column schema based on the search object. The search object for DAMOBJ_TYPE_COLUMN contains the column name.
The new mode requests schema information only of columns used in the query and also all columns on which indexes are exposed. The SCHEMA function is called once for each column, and returns a single schema object in each call.
If the query uses SELECT *, then the schema for all columns is requested. There is no filter on the column name.
This feature is supported only for SELECT and DELETE queries. When INSERT and UPDATE queries are run, the schema for all columns is requested.
When the IP is operating in this mode, the IP should no longer rely on iColNum that is returned from dam_describeCol and other DAM API to indicate the column number in the table. It should just be used to uniquely identify the column for the current query execution, so that the same column (ename) would have different iColNum based on query. Use OA_USERDATA to store information that is required to associate the column that is exposed as part of the schema with the actual data in the data source.
SELECT empno, ename FROM emp; => iColNum FOR ename may be 2
SELECT ename FROM emp; => iColNum FOR ename may be 1