Sie sind auf Seite 1von 3

What are the different types of bind and how are they different?

There are two types of BINDS - BIND PLAN and BIND PACKAGE. BIND PLAN accepts one or more DBMRs produced from previous DB2 precompilations, one or more packages from previous BIND PACKAGE commands or a combination of DBMRs and Packaging lists as input. The output of the BIND PLAN is an application plan containing the executable logic representing optimized access paths to DB2 data. An application plan is executable only with the corresponding load module. Before you can run a DB2 program, an application plan name must be specified. The BIND PACKAGE command accepts a DBMR as input and produces a single package containing the optimized access path logic. You can then bind the packages into an application plan using the BIND PLAN command. A package is not executable and cannot be specified when a DB2 program is being run. You must bind a package into a plan before using it. What are the advantages and disadvantages of using an index? Indexes speed up the execution of SQL statements with search conditions, which refer to the indexed columns. One disadvantage on the index is that it is a separate database object and needs additional disk space. Another disadvantage is that the index must be updated every time a row is inserted, deleted or modified. This imposes additional overheads for the INSERT, DELETE and UPDATE operations.

What are composite indexes? When an index is made up of more than one column, that is called a composite index. Composite indexes are used when two or more columns are best searched as a unit because of their logical relationship.

What are unique indexes? A unique index is one in which no two rows are permitted or in which no duplicate values are allowed for the same index value. Unique indexes are usually created on the primary key (or any of the candidate key) of a table.

What are clustered indexes? When you create a clustered index, it means that the system will sort the rows of a table when there is a change is made to the index. Or in other words, when you use the clustered index, the rows in the table will be in the same order as that of the index. Since clustered index controls the physical location of data, there can be only one clustered index per table, most often created on the primary key. In a nonclustered index, the physical order of the rows is not the same as their indexed order. There can be as many non-clustered indexes per table.

What are the advantages and disadvantages of using clustered indexes? Clustered indexes are much faster than non-clustered ones. A clustered index is usually very advantageous when many rows with contiguous values are being retrieved. But clustered indexes make the data addition and modification process slower as the data in the table also has to be sorted along with that in the index. What is a subquery? Subqueries are nested SELECT statements. Or in other words, they are SELECT...FROM...WHERE... expressions nested inside another suck expression. Subqueries enable the user to base the search criteria of one SELECT statement on the results of another SELECT statement. Subqueries always appear as part of the WHERE clause or HAVING clause. In the WHERE clause they selects the individual rows that appear in the query results. In the HAVING clause, they help to select the row groups that appear in the query results. What is the difference between smallint and integer? A smallint datatype is 2 bytes long and has a range from -32768 to +32767, where as an integer is 4 bytes long and stores numeric data ranging from -2147483648 to +2147483647. What is an index? An index is a structure that provides faster access to the rows of a table based on the values of one or more columns. The index stores data values and pointers to the rows where those data values occur. In the index the data values are sorted and sorted in the ascending or descending order. So, the RDBMS can quickly search the index to find a particular data value and hence the row associated with it. What is meant by an index? An index is a set or row identifiers or pointers that are logically ordered by the values of a column that has been specified as being an index. Indexes provide faster access to data an can enforce uniqueness on the row in a table. What is mean by an index scan? When an entire index is scanned to locate rows, we call this an index scan. This type of access can be used to select all rows of a table in some order and avoid a sort for a query. What is a join? A join is relational operation that allows retrieval of data from two or more tables based on matching column values.

What is meant by null? This is a special value that indicates the absence of data in column. This value is indicated by a negative value, usually -1.

What does DB2 EXPLAIN do? EXPLAIN obtains information like which indexes are used, whether sorting is necessary, which level of locking is applied, etc., about SQL statements in the DBRM are executed and will put all this information into the ID.PLAN_TABLE where ID is the authorization ID of the owner of the plan. What is a foreign key? A foreign key is a column or combination of columns in a table whose values are required to match with those of the primary key in some other table.

What is referential integrity? Referential integrity defines the relationships between different columns in a relational database. It is called referential integrity, because the values in one column or columns must refer to or match the values in a related column or set of columns. What is an access path? The path that is used to get to the data specified in the SQL statements. What is plan? A plan is a DB2 object produced during the bind process that associates one or more database request modules. What is the DB2 Bind operation? Bind is a process that builds access paths to Db2 tables. The bind uses the Database Request Modules (DBRMs) from the DB2 precompiler as the input and produces an application plan. It also checks the users authorization level and validates the SQL statements in the DBMRs. What is a Clustering index? It is a type of index that locates table rows and determines how rows are grouped together in the tablespace.

Das könnte Ihnen auch gefallen