Abstract:
A database management system (DBMS) provided with a multi-dimensional improved indexed accessing capability using keyed index searching. Individual search keys are constructed from general expression statements created in the DBMS compiler from search queries supplied to the DBMS. Each key column represents another dimension, and both ranges and IN lists can be specified in the search query and used as the predicate values in multiple columns. Missing predicate values in the search query are interpreted as a specification of the minimum and maximum values for the associated search key column. During compile time, the DBMS compiler produces general expressions to be used by the DBMS executor during run time to create the search keys. The DBMS compiler evaluates search queries by associating predicates with clusters and disjunct numbers assigned to each individual disjunct in the search query expression. The DBMS executor uses the general expression from the compiler and eliminates any conflicts among same column predicates, removes redundancies in predicate values and disjuncts and reduces the number of records to be accessed to the minimum required to complete the search query. The individual search keys are generated in the same order as the index to which the search pertains (i.e., increasing or decreasing order).

Description:
BACKGROUND OF THE INVENTION 
     This invention relates generally to relational database management systems, and particularly to a relational database management system with improved indexed accessing. 
     Most relational database management systems (DBMS) use B-Trees to allow users to perform queries on large databases or tables using appropriate commands, such as SQL (structured query language) commands. A B-Tree is an index residing in the database memory and having one or more columns, with each column representing another dimension in the index. B-Trees permit searching for records in a database using one or more keys specified by users by means of appropriate query commands. Because the keys define a subset of an entire table of records, indexed searching can eliminate the need to search through the entire table of records in order to retrieve a much smaller subset of such records pertinent to the user query. 
     Ideally, for most queries, indexed accessing enables the pertinent records to be accessed at minimum transactional cost (the cost being measured by an appropriate parameter, such as the equivalent number of secondary storage accesses as required to complete the query). However, many user queries presented to a DBMS using a B-Tree index structure cannot be processed using an indexed access technique. In such cases, the entire table of records must be searched, which is time consuming and relatively inefficient. In addition, the extent to which the total number of records required to be searched can be reduced is severely limited in a B-Tree index structure by virtue of the constraint that only one key column in an index can be used to specify a range of values or a specific list of values (termed an IN list). For example, consider a table T having columns (a, b, c, d, e, f, g) and a corresponding index I having columns (a, b, c, d). A user query requesting that the DBMS select all records for the predicates: 
     where a=10 
     and b between 20 and 30 
     and c=40 
     and d=50 
     would result in begin-end keys of the form: 
     begin key: a=10, b&gt;=20 
     end key: a=10, b&lt;=30 
     Even though the predicates specify c=40 and d=50, these two equality predicates on key columns c and d are not incorporated in the search key due to the range on b. As a result, a search in the index for records conforming to the predicates will be able to seek to the nearest (a, b) pair, but cannot position precisely on the desired (a, b, c, d) values. Stated differently, all of the c and d values in the index must be examined and compared with the specific c and d values desired. Depending on the number of records in the c and d columns, the length of time required to perform the index search (and thus the cost), at best, is greater than optimal. 
     Another disadvantage with existing B-Tree index structures is the constraint imposed when a key column predicate is missing (unspecified). For example, consider the predicates: 
     where a=10 
     and c=40 
     and d=50 
     The begin-end key constructed by the traditional key building method is as follows: 
     begin key: a=10 
     end key: a=10 
     In this case, the absence of a predicate on column b prevents the predicates on columns c and d from being used. Consequently, the index table must be searched for all values (b, c, d). A special case occurs when the missing key predicate is on the first column of a partitioning key. For example, consider the predicates: 
     where b=30 
     and c=40 
     and d=50 
     The traditional key building method cannot construct a search key from these predicates because a predicate on the first column a of the partitioning key is missing. As a result, the query execution plan composed by the DBMS must perform a full table scan. 
     Still another disadvantage inherent in the B-Tree index structure results when the search query includes an intervening IN predicate. For example, consider the predicates: 
     where a=10 
     and b in (20, 30) 
     and c=40 
     and d=50 
     The IN predicate on column b specifies an equality comparison with a set of values. The traditional key building method is capable of dealing with an equality comparison that involves exactly one value, but not a set of values. Consequently, the IN predicate cannot be used in the key. As a result, the search key contains only column a: 
     begin key: a=10 
     end key: a=10 
     The absence of a usable key predicate on column b prevents the predicates on columns c and d from being used. As a result, a complete search of columns b, c, d must be conducted. 
     Another disadvantage with existing B-Tree index-based DBMSs results from the mandatory use of the disjunctive normal form for the predicates of the query commands. More particularly, predicates are in disjunctive normal form when only ORs exist at the outer level. For example, consider the query command: 
     SELECT * 
     FROM T 
     WHERE (a=5 and ( (b=1 and c IN (2,4,9)) 
     OR (b=8 and c=7)) 
     OR (a between 4 and 6 and ( (b between 8 and 10 and c between 6 and 9) 
     OR (b=9 and c=11) 
     The disjuncts for this expression are: 
     (a=5 and b=1 and c IN (2,4,9)) 
     OR (a=5 and b=8 and c=7) 
     OR (a&gt;=4 and a&lt;=6 and b&gt;=8 and b&lt;=10 and c&gt;=6 and c&lt;=9) 
     OR (a&gt;=4 and a&lt;=6 and b=9 and c=11) 
     In a typical known DBMS, the search for all records pertinent to the query command would begin with the first disjunct. Once all such records have been found, the search would be conducted for all records pertinent to the second disjunct, followed by a search for all records pertinent to the third disjunct, and ending with all records pertinent to the fourth disjunct. This technique is inefficient due to the fact that the single record in the second disjunct is accessed again during the search for records pertinent to the third disjunct. Although the above example requires only one repetitive reading of the same record, in practice relatively large numbers of repetitions occur routinely when accessing records in relatively large databases. 
     Further compounding the repetitive record problem is the fact that a record cannot be returned twice to a user during an access due to semantic constraints imposed by the system. Consequently, most DBMSs must create a table of records that have been read during an access, which can require a substantial amount of memory space, depending upon the number of records specified by the search query. 
     This problem of repetitive record accessing is sometimes exacerbated by the appearance of conflicting predicates in a query command. While a user rarely submits a query command with conflicting predicates, the problem can frequently arise when views with hidden predicates are used or when host variables are used in combination with fixed values, or when queries are generated by software. For example, assume the following view exists: 
     Create view VT as SELECT * from T where b IN (3, 9, 16, 25, 36); 
     Assume the user query is: SELECT * from VT 
     WHERE 
     b between 20 and 30 
     AND c IN (40, 100, 150) 
     AND d=50; 
     In this example, the user has unknowingly required the DBMS to search all values of b in the view lying in the range between 20 and 30, when there is only one value b in the view lying within this range. As a result, all values of b between 20 and 30 will be accessed, resulting in 30 unnecessary records (10 unnecessary b values times 3 c values). 
     SUMMARY OF THE INVENTION 
     The invention comprises a method and system for affording improved indexed accessing of records in a relational database management system which is capable of substantially reducing the total number of records accessed in a given search, which permits ranges and IN lists on multiple columns of a search key, which constructs a usable search key in the absence of one or more column values, and which orders the individual columns of the search key in the same manner as the table to which the key pertains. 
     The invention is carried out by means of a portion of a DBMS compiler termed the Optimizer and a DBMS Executor. The Optimizer is a process component of a DBMS compiler which initially evaluates a search query and generates key expressions for the DBMS Executor. The key expressions describe multi-column keys, including the range and IN list predicates on the individual columns. The Optimizer performs general OR optimization and associates query statement predicates with clusters and disjunct numbers. The use of disjunct numbers in the Optimizer allows the invention to minimize memory space usage for the predicates and disjuncts, since predicates are not repeated: rather, a list of disjunct numbers in which each predicate appears is created. Predicates may share a common set of disjunct numbers. IN lists are treated as a single disjunct to minimize the number of disjuncts. 
     The DBMS Executor comprises a set of procedures in the DBMS system library that executes compiled query statements against database tables, views or catalogs. The DBMS Executor evaluates the key expressions supplied by the Optimizer portion of the DBMS compiler in order to create a data structure termed a GEM-tree. Each GEM-tree contains information concerning key columns, describing ranges and exact values, predicates defined on each column, comparison operators and other information. The process of building the GEM-tree conducted in the DBMS Executor includes combining ranges and eliminating duplicates on the key columns, while preserving the order in each column (i.e., ascending order or descending order). After a GEM-tree has been constructed by the DBMS Executor, values are retrieved from the tree to build the actual keys for reading data from the required tables. 
     In the process of constructing the GEM-tree, the DBMS Executor sorts and collapses values from different disjuncts in a column together so that individual records are only read once. This results in a significant saving in the cost of executing a search plan, since all duplicate values are eliminated. Further, the keys are built in such a fashion that the data from each index is read in index order, even when multiple disjuncts are present, which facilitates the accessing of individual records. 
     The use of disjunct numbers in the DBMS Executor on a per column basis allows the collapse of multiple column disjuncts so that the same record never needs to be read twice. This facilitates the sorting and collapsing of values by the DBMS Executor. 
     The DBMS Executor also finds the minimum set of all predicates for a disjunct from all predicates for that column in a disjunct. This occurs when there are multiple predicates on a single column which conflict. The minimum set of all predicates is determined by finding the minimum set of values necessary for the combination of predicates. This technique, taken together with the sorting and collapsing of values from different disjuncts ensures that only the minimum amount of data need be read. 
     In the process of constructing the GEM-tree, the DBMS Executor recognizes missing keys and the specification of ranges and IN lists in the generalized key expressions supplied by the Optimizer portion of the DBMS compiler. This permits a multi-dimensional view of the index, and allows efficient access. 
     For a fuller understanding of the nature and advantages of the invention, reference should be had to the ensuing detailed description taken in conjunction with the accompanying drawings. 
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS 
     FIG. 1 is a block diagram of a computer system for storing and providing user access to data in stored databases; 
     FIG. 2 is a block diagram of data structures stored in a database management system; 
     FIG. 3 is a block diagram of the catalog data structure, representing database tables and programs, shown in FIG. 2; and 
     FIGS. 4A-4H are block diagrams representing portions of the tables included in the catalog data structure of FIG. 3. 
    
    
     DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS 
     Referring to FIG. 1, there is shown a computer system 100 for storing and providing user access to data in stored databases. The system 100 is a distributed computer system having multiple computers 102, 104, 106 interconnected by local area and wide area network communication media 108. The system 100 generally includes at least one database server 102 and many user workstation computers or terminals 104, 106. 
     When very large databases are stored in a system, the database tables will be partitioned, and different partitions of the database tables will often be stored in different physical disks controlled by different CPUs. However, from the viewpoint of user workstation computers 104, 106, the database server 102 appears to be a single entity. The partitioning of databases is well known to those skilled in the art. 
     As shown in FIG. 1, the database server 102 includes a central processing unit (CPU) 110, primary memory 112, a communications interface 114 for communicating with user workstations 104, 106 as well as other system resources not relevant here. Secondary memory 116, typically magnetic disc storage, in the database server 102 stores database tables 120, database indices 122, a database management system (DBMS) 123 for enabling user and operator access to the database tables, and one or more catalogs 126 for storing schema information about the database tables 120 as well as directory information for programs used to access the database tables. The DBMS 123 includes a SQL executor 124 as well as other database management subsystems, such as an SQL catalog manager 125 and an SQL command interpreter. The DBMS 123 further includes an SQL compiler 128 for compiling source code database query programs 130 into compiled execution plans 132. The SQL compiler 128 can also be used to compile any specified SQL statement so as to generate an execution plan. 
     End user workstations 104, 106, typically include a central processing unit (CPU) 140, primary memory 142, a communications interface 144 for communicating with the database server 102 and other system resources, secondary memory 146, and a user interface 148. The user interface 148 typically includes a keyboard and display device, and many include additional resources such as a pointing device and printer. Secondary memory 146 is used for storing computer programs, such as communications software used to access the database server 102. Some end user workstations 106 may be &#34;dumb&#34; terminals that do not include any secondary memory 146, and thus execute only software downloaded into primary memory 142 from a server computer, such as the database server 102 or a file server (not shown). 
     Glossary 
     To assist the reader, the following glossary of terms used in this document is provided. 
     SQL: SQL stands for &#34;Structural Query Language.&#34; Most commercial database servers utilize SQL. Any program for accessing data in a database which utilizes SQL is herein called an &#34;SQL Program.&#34; Each statement in an SQL program used to access data in a database is called an &#34;SQL statement.&#34; An SQL program contains one or more SQL statements. 
     Execution Plan: An SQL statement which has been compiled into an intermediate form that specifies a method to efficiently access data in a database. 
     Execution Characteristics: Characteristics of an execution plan that have no effect on its semantics (i.e., operability). Examples are the performance of a plan, and its resource consumption. 
     Object(s): An object is a file, database table or other encapsulated computer resource accessed by a program as a unitary structure. In the context of the preferred embodiment, objects are database tables. In other implementations of the present invention, objects may be other encapsulated computer resources which the end user accesses indirectly through validated methods (i.e., programs) designated specifically to access those computer resources. 
     DDL Statement: A data definition language statement. DDL statements are used to create and modify database object (e.g., tables and indices). 
     DEFINE name: An object handle or link indicating an object to be accessed by an execution plan. An SQL statement may reference objects via a DEFINE names, instead of referencing them directly. This enables the operator to redirect the program to access a different set of objects than the compile-time objects, without having to alter the program, by merely altering the DEFINE names to point to new objects before executing the program. 
     Source Code Program/Statement: For each execution plan there is a corresponding source code SQL statement. A source code program is the set of SQL statements corresponding to a set of execution plans which together are herein called a &#34;compiled program.&#34; 
     SQL compilation: The act of compiling an SQL statement program or an SQL program. The compilation can be a &#34;static&#34; compilation, performed by invoking an SQL compiler, such as Tandem&#39;s® SQLCOMP™, to generate new execution plans for SQL statements in the program. An SQL compilation can also be a dynamic compilation, such as an automatic recompilation initiated due to a program being marked invalid or due to timestamp mismatch between an SQL statement and an object referenced by the statement. 
     End user: A person using a workstation to access database information in a database server. End users typically do not have the authority to modify the structure of database tables. 
     Operator: A person using a workstation who has the authority and access rights to modify the structure of database tables and to manually initiate compilation of SQL source code programs. 
     View: A logical definition of a relation without physical existence. The data presented by a view is derived from a Base Table. 
     GEM: The acronym for general expression method, the term used to denote the several aspects of the invention. 
     MDAM: The acronym for multi-dimensional access method, an alternate term for the invention. 
     Database Server 
     FIG. 2 depicts some of the interrelationships between the data structures and programs stored in the database server 102. 
     A source code program 130-1 includes a sequence of SQL source code statements 160 as well as other non-SQL source code statements (e.g., assignments, and program flow control statements). SQL compiler 128 compiles the SQL source code statements into a compiled program 132-1 having a sequence of compiled statements 162 herein called execution plans. Each source code statements 160 has a corresponding execution plan 162. The compiled 132 program 132 includes a &#34;file label&#34; 164 (i.e., a data structure in the program) that stores a set of runtime properties used by the SQL executor 124, as will be discussed in more detail below. In addition, each execution plan 162 includes, in addition to the compiled query, a timestamp 166 and a set of schema information 170 for each of the database objects to be accessed by that execution plan. 
     Each database table or object 120 includes a &#34;disk label&#34; 180, herein called an object header, and an object body 182. The object header 180 stores information about the structure, identity and other characteristics of the database object 120, while the object body stores the data content of the database object. The object header 180 includes an object name field 184 and an object schema 186 defining the structure and other characteristics of the data in the database object. The object schema 186 stored in the database object&#39;s &#34;disk label&#34; 180 is a compact representation of the catalog information stored for the database table in the SQL catalog 126 and thus includes data attribute definitions 188, timestamps 190 and other object parameters 192. 
     The catalog 126 is itself a database having a set of tables for storing information about the database objects (e.g., tables and indices) stored in the database server as well as information about the programs stored in the database server. The structure of the catalog 126 will be described in more detail with reference to FIGS. 3 and 4A through 4H. 
     The compiler 128, as mentioned above, compiles an SQL program 130 into a compiled SQL program 132 having a set of execution plans 162. Operation of the compiler is initiated by either a manually entered compiler command 194 or a recompile command 196 generated by the SQL executor 124 when it attempts to execute an invalid or inoperable execution plan. Manually initiated compilations are governed by user or operator entered commands 194 or, more commonly, user or operator initiated scripts that contain sequences of data definition and compiler commands. 
     The SQL executor 124 responds to both end user and operator runtime commands 198. Such runtime commands include standard end user initiated plan execution commands, such as to retrieve data from database tables and to add data to database tables. Runtime commands 198 also include DDL statements, for creating database tables and for modifying the structure of existing database tables, although the authority to use these runtime commands 198 is usually restricted to a set of persons herein called operators. For a fuller description of the FIG. 1 system operation, reference may be made to &#34;TANDEM SYSTEMS REVIEW&#34;, Vol. 4, No. 2 Jul., 1988, the disclosure of which is hereby incorporated by reference. 
     Catalog and Disk Label Data Structures 
     Referring to FIG. 3, the catalog 126 in the preferred embodiment, consists of a set of tables 200-220 representing database tables and programs in a database server or set of database servers. 
     Referring to FIG. 4A, the &#34;Tables&#34; table 200 includes one record 222 for each database table in the database server. Each record 222 includes the following fields: 
     TableName 224, denoting the name of the database table; 
     TableType 225, indicating whether the referenced database table is a true database table or a &#34;view,&#34; which is a subset of one or more database tables that are referenced in the same manner as a database table by SQL statements; 
     ColumnCount 226, indicating the number of distinct columns in the table (or view); 
     CreateTime 227, is a timestamp value indicating when the table (or view) was first created; 
     RedefTime 228, is a timestamp value indicating when the table (or view) was last altered; 
     SimilarityCheck 229, is a flag whose value is Enabled when similarity checks on the table are allowed and is Disabled otherwise; and other parameters 230 not relevant here. 
     Referring to FIG. 4B, the &#34;Base Tables&#34; table 202 includes one record 232 for each database table in the database server. Each record 232 includes the following fields: 
     TableName 234 denoting the name of the database table; 
     FileName 235, indicting the name of the disk file in which the referenced database table is stored; 
     RowCount 236, indicating the number of rows in the table; 
     RowSize 237, indicating the maximum size (in bytes or words) of each row; 
     ValidDef 238, is a flag (Y or N) value indicating if the file has a valid definition, correct file label and catalog entries; 
     ValidDef 239, is a flag (Y or N) value indicating if the data in the table is consistent with data in the table&#39;s indexes and satisfies constraints on the table; 
     Constraints 240, is a flat (Y or N) value indicating whether the table has any defined constraints; and other parameters 241 not relevant here. 
     Referring to FIG. 4C, the &#34;Columns&#34; table 204 includes one record 252 for each column of each database table in the database server. Each record 252, representing characteristics of one database table column, includes the following fields: 
     TableName 254, denoting the name of the database table in which the column corresponding to this record 252 resides; 
     ColumnNumber 255, denotes a number indicating the position of the column in each row of the table, where the first column has a Column/Number of 0; 
     ColumnName 256, denotes the column&#39;s name, also called the SQL identifier, for the column; 
     ColumnSize 257, indicating the size (in bytes or words) of the data in the column; 
     UniqueEntryCount 258, denotes the number of unique data entries in the column for the table or table partition; 
     HeadingText 259, denotes a text string used as a default column heading when printing data extracted from this the column of the database table; and other parameters 260 not relevant here. 
     Referring to FIG. 4D, the indexes table 210 includes one record 262 for each database index in the database server. Each record 262 includes the following fields: 
     TableName 263 denoting the name of the database table; 
     IndexName 264, indicating the name of the index; 
     ColCount 265, indicating the number of columns used in the index, including the primary key columns; 
     Keytag 266, specifying the keytag, if this is a primary key index for the database table; 
     ValidDef 267, is a flag (Y or N) value indicating if the index definition is valid; 
     ValidData 268, is a flag (Y or N) value indicating if the index has valid data; 
     UniqueValue 269, is a flag (Y or N) value indicating whether all entries in the index are unique; 
     IndexLevels 270, indicating the number of levels of indexing in this index; 
     RowSize 271, indicating the size of each index record; 
     FileName 272, indicating the file that contains the index; and other parameters 273 not relevant here. 
     Referring to FIG. 4E, the Keys table 212 includes one record 282 for each column of the primary key and each other index for each database table in the database server. Each record 282, representing one table column for one key or index, includes the following fields: 
     IndexName 283, denoting the name of the index; 
     KeySequenceNumber 284, indicates the position of the column in each index row; 
     TableColumnNumber 285, indicates the position of the column in each table row; and 
     Ordering 286, indicates whether the column is an ascending order or descending order column. 
     Referring to FIG. 4F, the Files table 206 includes one record 292 for each database table and index in the database server. Each record 292, representing characteristics of one database file, includes the following fields; 
     FileName 294, denoting the name of a database file, and corresponds to the FileName entry 235 in a Base Tables record 232 or an entry 272 in an index record 262; 
     FileType 295, indicates how data within the file is sequenced (e.g., entry sequenced, key sequenced, etc.); 
     BlockSize 296, denotes the size of the secondary memory blocks (e.g., 512, 1024, 2048 or 4096 bytes) in which the file is stored; 
     Partitioned 297, is a flag (Y or N) indicating whether or not the file is partitioned; 
     RecordSize 298, denotes the maximum length of a record in the file; 
     CompressionInfo 299, is a flag (Y or N) value indicating whether data in the data pages and index pages of the file have been compressed; 
     ExtentsInfo 300, denotes the size of the primary and secondary extents and the maximum number of extents in the file; and other parameters 301 not relevant here. 
     When a file is partitioned, the Partitions table 214 will contain one record for each partition of the file indicating the partition name and catalog entry for each partition as well as the starting values for each column in the file&#39;s primary key. 
     Referring to FIG. 4G, the Programs table 208 includes one record 312 for each registered program in the database server. Each record 312, representing characteristics of one program, includes the following fields: 
     ProgramName 314, denoting the name of a program;. 
     OwnerID 315, identifies the program&#39;s owner; 
     CreateTime 316, is a timestamp value indicating when the program was first SQL compiled; 
     RecompileTime 317, is a timestamp value indicating when the program was last recompiled; 
     Valid 318, is a flag (Y or N) value indicating whether or not the program is valid; 
     AutoCompile 319, is a flag (Y or N) value indicating whether automatic recompilations of the program are allowed at run time, if required; 
     RecompileMode 320, is a mode value that is set to &#34;All&#34; or &#34;OnDemand&#34; and governs (in conjunction with the AutoCompile and CheckMode parameters) when program and statements within the program are recompiled, as explained in more detail below; 
     CheckMode 321, is a mode value that is set to &#34;InvalidProgram,&#34; &#34;InvalidPlans,&#34; or &#34;InoperablePlans,&#34; and governs (in conjunction with the AutoCompile and REcompileMode parameters) when the program and statements within the program are recompiled; 
     SimilarityInfo 322, is a flag (Y or N) value indicating whether the compiled program includes similarity information for each of the program&#39;s compiled statements, where the similarity information for each statement consists of a subset of the schemas for database tables accessed by that statement; and other parameters 323 not relevant here. 
     Referring to FIG. 4H,, the Usages table 220 includes one record 330 for each usage of one object by another. For each program that uses a database table there is a record 330, representing that relationship that includes the following fields: 
     UsedObjectName 332, identifies the name of the &#34;used&#34; object, which in the context of this document is the tablename of a database table; 
     UsedObjectType 334, identifies the type of the used object, which in this case is &#34;table&#34;; other defined object types for used objects are &#34;view&#34; and &#34;index&#34;; 
     RelationshipType 336, is flag that is enabled if the using object depends on the used object; 
     UsingObjectName 337, identifies the name of the &#34;using&#34; object, which in the context of this document is the name of a program; 
     UsingObjectType 338, identifies the type of the using object, which in this case is &#34;program&#34;; other defined object types for using objects are &#34;view&#34; and &#34;index&#34;; and other parameters 339 not relevant here. 
     The principal components of the computer system of FIG. 1 used to implement the invention are a portion of the SQL Compiler 128 termed the Optimizer and the SQL Executor 124. The Optimizer is a process component of SQL Compiler 128 which initially evaluates a search query and generates key expressions for the SQL Executor 124. The key expressions describe multi-column keys, including the range and IN list predicates on the individual columns. The Optimizer conducts general OR optimization and associates predicates with clusters and disjunct numbers in the manner set forth in Appendix A. The use of disjunct numbers in the Optimizer allows the invention to minimize memory space usage for the predicates and disjuncts. More particularly, in prior art compilers the process of converting a search query to disjunctive normal form requires that the predicates be repeated for all the disjuncts in which they appear. In the invention, predicates are not repeated: rather, a list of disjuncts in which each predicate appears is created in the manner set forth in Appendix A. In addition, many predicates share a common set of disjunct numbers. Another advantage of the invention resides in the treatment of IN lists as a single disjunct in order to minimize the number of disjuncts. An IN list is a shorthand way of specifying a list of single predicates on the same column that are ORed together. This list of same column predicates ORed together is treated as a single disjunct. 
     The SQL Executor 124 comprises a set of procedures in the system library that executes compiled SQL statements against database tables, views or the database catalogs. The SQL Executor 124 evaluates key expressions supplied by the Optimizer portion of SQL Compiler 128 in order to create a data structure termed a GEM-tree. Each GEM-tree contains information concerning key columns, describing ranges and exact values, predicates defined on each column, comparison operators and other information. The process of building the GEM-tree conducted in the SQL Executor 124 includes combining ranges and eliminating duplicates on the key columns, while preserving the order in each column (i.e., ascending order or descending order). After a GEM-tree has been constructed by the SQL Executor 124, values are retrieved from the tree to build the actual keys for reading data from the required tables. The specific manner in which the SQL Executor 124 constructs a GEM-tree and builds the actual keys for reading data from the tables is set forth in Appendix B. 
     In the process of constructing the GEM-tree, the SQL Executor 124 sorts and collapses values from different disjuncts in a column together so that individual records are only read once. This is a significant saving in the cost of executing a search plan, since all duplicate values are eliminated. In addition, the keys are built in such a fashion that the data from each index is read in index order, even when multiple disjuncts are present, which facilitates the accessing of individual records. 
     The use of disjunct numbers in the SQL Executor 124 on a per column basis allows the collapse of multiple column disjuncts so that the same record never needs to be read twice. This facilitates the sorting and collapsing of values by the SQL Executor 124. 
     The SQL Executor 124 also finds the minimum set of all predicates for a disjunct from all predicates for that column in a disjunct. This occurs when there are multiple predicates on a single column which conflict. The SQL Executor 124 finds the minimum set of all predicates by finding the minimum set of values necessary for the combination of predicates, which avoids unnecessary reading of data. Taken together with the sorting and collapsing of values from different disjuncts, this ensures that only the minimum amount of data need be read. 
     In the process of constructing the GEM-tree, the SQL Executor 124 recognizes missing keys and the specification of ranges and IN lists in the generalized key expressions supplied by the Optimizer portion of SQL Compiler 128. This permits a multi-dimensional view of the index, and allows efficient access even if the user has defined a column to the beginning of an index for purely partitioning purposes. 
     Specific examples of the features noted above are as follows. 
     Intervening Range 
     Assume the user search query includes the following predicates: 
     WHERE a=10 
     AND b between 20 and 30 
     AND c=40 
     AND d=50; 
     In prior art systems, the predicates in column c and d cannot be used as keys because of the intervening range predicate on b. The invention allows the use of all four key columns in the following fashion. 
     Range predicates are processed in the SQL Executor 124 by stepping through the values of the column in the range. Assume the values of b between 20 and 30 are (20, 23, 25, 30). The SQL Executor 124 first performs a keyed access for 
     
         a=10, b=20, c=40, d=50 
    
     After all the records for these key columns have been received by the SQL Executor 124, it requests from the file system the next value of b, which is 23. The value 23 is then substituted as the key value for b: 
     
         a=10, b=23; c=40, d=50 
    
     After these records are retrieved, the next value of b is selected (i.e., the value 25). 
     Missing Key Predicate 
     Assume the user search query includes the following predicates: 
     WHERE 
     b between 20 and 30 
     AND c=40 
     AND d=50; 
     Since the predicate for key column a is missing (i.e., unspecified), prior art systems cannot use this index for keyed access. According to the invention, however, the missing predicate for column a is treated as an implied range of MIN --  VALUE to MAX --  VALUE (including NULL values). The SQL Executor 124 first requests the first value from column a from the file system, and substitutes that value in the begin key values. 
     Assume the values for a include all values from 1 to 100. The SQL Executor 124 first performs a keyed access with the following values: 
     
         a=1, b=20, c=40, d=50 
    
     After retrieving the records for this set of values, SQL Executor 124 varies b through its four values: 
     
         a=1, b=23, c=40, d=50 
    
     
         a=1, b=25, c=40, d=50 
    
     
         a=1, b=30, c=40, d=50 
    
     SQL Executor 124 then obtains the next value of a from the file system and repeats the values for b: 
     
         a=2, b=20, c=40, d=50 
    
     
         a=2, b=23, c=40, d=50 
    
     etc. 
     The result is a total of 400 accesses. 
     IN Lists 
     Assume the user search query includes the predicates: 
     WHERE 
     b between 20 and 30 
     AND c IN (40, 100, 150) 
     AND D=50; 
     Columns a and b are treated in the same fashion as in the missing key predicate example given above. In addition, the values of c are included. The SQL Executor 124 steps through all the given values for a, b and c. However, since the three values of c are specified by the IN list, the SQL Executor 124 can use these values directly (and need not request these values from the file system). 
     Elimination of Conflicting Predicates 
     Assume that the following view exists: 
     Create view VT as 
     SELECT * from T where b IN (3, 9, 16, 25, 36); 
     Assume the user query is: 
     SELECT * from VT 
     WHERE 
     b between 20 and 30 
     AND c IN (40, 100, 150) 
     AND d=50; 
     The only valid value for b in this query is 25. The SQL Executor 124 finds the union of all the predicates for b, and recognizes that only the value 25 exists in both sets, so only that value for b will be used to retrieve records. 
     General OR Optimization 
     As noted above, general OR optimization is accomplished by associating the predicates with different predicate sets in disjunctive normal form (with the exception of IN lists which are processed as a unit). Predicates are in disjunctive normal form when only ORs exists at the outer level. For example, consider the query command: 
     SELECT * 
     FROM T 
     WHERE (a=5 and ((b=1 and c IN (2,4,9)) 
     OR (b=8 and c=7)) 
     OR (a between 4 and 6 and ((b between 8 and 10 and c between 6 and 9) 
     OR (b=9 and c=11) 
     The disjuncts for this expression are: 
     (a=5 and b=1 and c IN (2,4,9)) 
     OR (a=5 and b=8 and c=7) 
     OR (a&gt;=4 and a&lt;=6 and b&gt;=8 and b&lt;=10 and c&gt;=6 and c&lt;=9) 
     OR (a&gt;=4 and a&lt;=6 and b=9 and c=11) 
     The SQL Executor 124 eliminates any conflicting predicates within each disjunct, and then combines the overlaps among the disjuncts so that only the minimum set of records is retrieved, and in the order of the index. For this example, the following retrievals are made: 
     a=4, b=8, c&gt;=6 and c&lt;=9 
     a=4, b=9, c&gt;=6 and c&lt;=9 
     a=4, b=9, c=11 
     a=4, b=10, c&gt;=6 and c&lt;=9 
     a=5, b=1, c=2 
     a=5, b=1, c=4 
     a=5, b=9, c=11 
     a=5, b=8, c&gt;=6 and c&lt;=9 
     a=5, b=9, c&gt;=6 and c&lt;=9 
     a=5, b=9, c=11 
     a=5, b=10, c&gt;=6 and c&lt;=9 
     a=6, b=8, c&gt;=6 and c&lt;=9 
     a=6, b=9, c&gt;=6 and c&lt;=9 
     a=6, b=9, c=11 
     a=6, b=10, c&gt;=6 and c&lt;=9 
     As will now be apparent, the invention affords several advantages over known B-Tree indexed access techniques. Firstly, by associating predicates with clusters and clusters with disjunct numbers, the invention permits the use of highly complex user search queries, and is thus not restricted to queries in which the predicates are already expressed in disjunctive normal form. In addition, the use of these associative techniques saves substantial space in memory by eliminating the need to store several copies of the same predicate. Further, the user can specify both ranges and IN lists in multiple key columns, and these ranges and IN lists will be observed in building the keys. Likewise, a missing key predicate, whether intentionally or inadvertently omitted, does not prevent the construction of a usable key index. Moreover, by sorting and collapsing values from different disjuncts and finding the minimum set of all predicates for a disjunct, repetitive reads of the same record are eliminated from the search key (which eliminates the need to construct a table of records that have been read) and only the minimum amount of data will be read in the proper order. 
     While the above provides a full and complete disclosure of the preferred embodiments of the invention, various modifications, alternate constructions and equivalents will appear to those skilled in the art. For example, although the invention has been described with reference to a DBMS employing SQL, other query languages may be employed, as desired. Therefore, the above descriptions and illustrations should not be construed as limiting the invention, which is defined by the appended claims. ##SPC1##