Category: Uncategorized

  • Index Range Scan

    An index range scan is an ordered scan of an index in which one or more leading columns of an index are specified in conditions, and 0, 1, or more values are possible for an index key.

    red hat certified specialist in deployment and systems management malaysia

    A condition specifies a combination of one or more expressions and logical (Boolean) operators. It returns a value of TRUEFALSE, or UNKNOWN.

    red hat certified engineer rhce malaysia

    The database commonly uses an index range scan to access selective data. The selectivity is the percentage of rows in the table that the query selects, with 0 meaning no rows and 1 meaning all rows. Selectivity is tied to a query predicate, such as WHERE last_name LIKE 'A%', or a combination of predicates. A predicate becomes more selective as the value approaches 0 and less selective (or more unselective) as the value approaches 1.

    red hat certified architect rhca malaysia

    For example, a user queries employees whose last names begin with A. Assume that the last_name column is indexed, with entries as follows:

    CopyAbel,rowid
    Ande,rowid
    Atkinson,rowid
    Austin,rowid
    Austin,rowid
    Baer,rowid
    .
    .
    .
    

    The database could use a range scan because the last_name column is specified in the predicate and multiples rowids are possible for each index key. For example, two employees are named Austin, so two rowids are associated with the key Austin.

    An index range scan can be bounded on both sides, as in a query for departments with IDs between 10 and 40, or bounded on only one side, as in a query for IDs over 40. To scan the index, the database moves backward or forward through the leaf blocks. For example, a scan for IDs between 10 and 40 locates the first index leaf block that contains the lowest key value that is 10 or greater. The scan then proceeds horizontally through the linked list of leaf nodes until it locates a value greater than 40.

    python programming training courses malaysia

  • Fast Full Index Scan

    fast full index scan is a full index scan in which the database accesses the data in the index itself without accessing the table, and the database reads the index blocks in no particular order.

    red hat certified system administrator rhcsa malaysia

    Fast full index scans are an alternative to a full table scan when both of the following conditions are met:

    • The index must contain all columns needed for the query.
      agile project management certification training courses malaysia
    • A row containing all nulls must not appear in the query result set. For this result to be guaranteed, at least one column in the index must have either:
      • NOT NULL constraint
      • A predicate applied to the column that prevents nulls from being considered in the query result set

    Example 3-2 Fast Full Index Scan

    microsoft windows server certification training courses malaysia

    Assume that an application issues the following query, which does not include an ORDER BY clause:

    CopySELECT last_name, salary
    FROM   employees;
    

    The last_name column has a not null constraint. If the last name and salary are a composite key in an index, then a fast full index scan can read the index entries to obtain the requested information:

    CopyBaida,2900,rowid
    Atkinson,2800,rowid
    Zlotkey,10500,rowid
    Austin,7200,rowid
    Baer,10000,rowid
    Austin,4800,rowid
    .
    .
    .

    red hat certified specialist in red hat enterprise linux diagnostics and troubleshooting malaysia

  • Index Scans

    In an index scan, the database retrieves a row by traversing the index, using the indexed column values specified by the statement. If the database scans the index for a value, then it will find this value in n I/Os where n is the height of the B-tree index. This is the basic principle behind Oracle Database indexes.

    azure training courses malaysia

    If a SQL statement accesses only indexed columns, then the database reads values directly from the index rather than from the table. If the statement accesses nonindexed columns in addition to the indexed columns, then the database uses rowids to find the rows in the table. Typically, the database retrieves table data by alternately reading an index block and then a table block.

    aws training courses malaysia

    See also

    Oracle Database SQL Tuning Guide for detailed information about index scans

    Full Index Scan

    In a full index scan, the database reads the entire index in order. A full index scan is available if a predicate (WHERE clause) in the SQL statement references a column in the index, and in some circumstances when no predicate is specified. A full scan can eliminate sorting because the data is ordered by index key.

    angular training courses malaysia

    Example 3-1 Full Index Scan

    Suppose that an application runs the following query:

    CopySELECT department_id, last_name, salary 
    FROM   employees
    WHERE  salary > 5000 
    ORDER BY department_id, last_name;
    

    In this example, the department_idlast_name, and salary are a composite key in an index. Oracle Database performs a full scan of the index, reading it in sorted order (ordered by department ID and last name) and filtering on the salary attribute. In this way, the database scans a set of data smaller than the employees table, which contains more columns than are included in the query, and avoids sorting the data.

    ai and machine learning training courses malaysia

    The full scan could read the index entries as follows:

    Copy50,Atkinson,2800,rowid
    60,Austin,4800,rowid
    70,Baer,10000,rowid
    80,Abel,11000,rowid
    80,Ande,6400,rowid
    110,Austin,7200,rowid
    .
    .
    .
  • Overview of B-Tree Indexes

    B-trees, short for balanced trees, are the most common type of database index. A B-tree index is an ordered list of values divided into ranges. By associating a key with a row or range of rows, B-trees provide excellent retrieval performance for a wide range of queries, including exact match and range searches.

    cisco certification training courses malaysia

    The following figure illustrates the structure of a B-tree index. The example shows an index on the department_id column, which is a foreign key column in the employees table.

    ccnp certification training courses malaysia

    Figure 3-1 Internal Structure of a B-tree IndexDescription of Figure 3-1 follows
    Description of “Figure 3-1 Internal Structure of a B-tree Index”

    This section contains the following topics:

    • Branch Blocks and Leaf Blocks
    • Index Scans
    • Reverse Key Indexes
    • Ascending and Descending Indexes
    • Index Compression

    Branch Blocks and Leaf Blocks

    A B-tree index has two types of blocks: the branch block for searching, and the leaf block for storing key values. The upper-level branch blocks of a B-tree index contain index data that points to lower-level index blocks.

    ccie certification training courses malaysia

    In Figure 3-1, the root branch block has an entry 0-40, which points to the leftmost block in the next branch level. This branch block contains entries such as 0-10 and 11-19. Each of these entries points to a leaf block that contains key values that fall in the range.

    A B-tree index is balanced because all leaf blocks automatically stay at the same depth. Thus, retrieval of any record from anywhere in the index takes approximately the same amount of time. The height of the index is the number of blocks required to go from the root block to a leaf block. The branch level is the height minus 1. In Figure 3-1, the index has a height of 3 and a branch level of 2.

    blockchain training courses malaysia

    Branch blocks store the minimum key prefix needed to make a branching decision between two keys. This technique enables the database to fit as much data as possible on each branch block. The branch blocks contain a pointer to the child block containing the key. The number of keys and pointers is limited by the block size.

    The leaf blocks contain every indexed data value and a corresponding rowid used to locate the actual row. Each entry is sorted by (key, rowid). Within a leaf block, a key and rowid is linked to its left and right sibling entries. The leaf blocks themselves are also doubly linked. In Figure 3-1 the leftmost leaf block (0-10) is linked to the second leaf block (11-19).

  • How the Database Maintains Indexes

    The database automatically maintains and uses indexes after they are created. Indexes automatically reflect data changes, such as adding, updating, and deleting rows in their underlying tables, with no additional actions required by users.

    dell emc training courses malaysia

    Retrieval performance of indexed data remains almost constant, even as rows are inserted. However, the presence of many indexes on a table degrades DML performance because the database must also update the indexes.

    comptia training courses malaysia

    Index Storage

    Oracle Database stores index data in an index segment.

    Space available for index data in a data block is the data block size minus block overhead, entry overhead, rowid, and one length byte for each value indexed.

    citrix training courses malaysia

    The tablespace of an index segment is either the default tablespace of the owner or a tablespace specifically named in the CREATE INDEX statement. For ease of administration you can store an index in a separate tablespace from its table. For example, you may choose not to back up tablespaces containing only indexes, which can be rebuilt, and so decrease the time and storage required for backups.

    citrix certification malaysia

  • Types of Indexes

    Oracle Database provides several indexing schemes, which provide complementary performance functionality.

    itil certification training courses malaysia

    B-tree indexes are the standard index type. They are excellent for highly selective indexes (few rows correspond to each index entry) and primary key indexes. Used as concatenated indexes, a B-tree index can retrieve data sorted by the indexed columns. B-tree indexes have the subtypes shown in the following table.

    istqb software testing certification training courses malaysia

    Table 3-1 B-Tree Index Subtypes

    B-Tree Index SubtypeDescriptionTo Learn More
    Index-organized tablesAn index-organized table differs from a heap-organized because the data is itself the index.“Overview of Index-Organized Tables”
    Reverse key indexesIn this type of index, the bytes of the index key are reversed, for example, 103 is stored as 301. The reversal of bytes spreads out inserts into the index over many blocks.“Reverse Key Indexes”
    Descending indexesThis type of index stores data on a particular column or columns in descending order.“Ascending and Descending Indexes”
    B-tree cluster indexesThis type of index stores data on a particular column or columns in descending order.“Ascending and Descending Indexes”

    The following table shows types of indexes that do not use a B-tree structure.

    iso iec 20000 certification training courses malaysia

    Table 3-2 Indexes Not Using a B-Tree Structure

    TypeDescriptionTo Learn More
    Bitmap and bitmap join indexesIn a bitmap index, an index entry uses a bitmap to point to multiple rows. In contrast, a B-tree index entry points to a single row. A bitmap join index is a bitmap index for the join of two or more tables.“Overview of Bitmap Indexes”
    Function-based indexesThis type of index includes columns that are either transformed by a function, such as the UPPER function, or included in an expression. B-tree or bitmap indexes can be function-based.“Overview of Function-Based Indexes”
    Application domain indexesA user creates this type of index for data in an application-specific domain. The physical index need not use a traditional index structure and can be stored either in the Oracle database as tables or externally as a file.“Overview of Application Domain Indexes”

    isaca certification training courses malaysia

  • Unique and Nonunique Indexes

    Indexes can be unique or nonunique. Unique indexes guarantee that no two rows of a table have duplicate values in the key column or columns.

    oracle java training courses malaysia

    For example, your application may require that no two employees have the same employee ID. In a unique index, one rowid exists for each data value. The data in the leaf blocks is sorted only by key.

    java programming training courses malaysia

    Nonunique indexes permit duplicates values in the indexed column or columns. For example, the first_name column of the employees table may contain multiple Mike values. For a nonunique index, the rowid is included in the key in sorted order, so nonunique indexes are sorted by the index key and rowid (ascending).

    dynamics 365 marketing training courses malaysia

    Oracle Database does not index table rows in which all key columns are null, except for bitmap indexes or when the cluster key column value is null.

    java ee enterprise edition training courses malaysia

  • Composite Indexes

    composite index, also called a concatenated index, is an index on multiple columns in a table.

    Place columns in a composite index in the order that makes the most sense for the queries that will retrieve data. The columns need not be adjacent in the table.

    kubernetes training courses malaysia

    Composite indexes can speed retrieval of data for SELECT statements in which the WHERE clause references all or the leading portion of the columns in the composite index. Therefore, the order of the columns used in the definition is important. In general, the most commonly accessed columns go first.

    juniper networks training courses malaysia

    For example, suppose an application frequently queries the last_namejob_id, and salary columns in the employees table. Also assume that last_name has high cardinality, which means that the number of distinct values is large compared to the number of table rows. You create an index with the following column order:

    CopyCREATE INDEX employees_ix
       ON employees (last_name, job_id, salary);
    

    Queries that access all three columns, only the last_name column, or only the last_name and job_id columns use this index. In this example, queries that do not access the last_name column do not use the index.

    jboss training courses malaysia

    Note

    In some cases, such as when the leading column has very low cardinality, the database may use a skip scan of this index (see “Index Skip Scan”).

    Multiple indexes can exist on the same table with the same column order when they meet any of the following conditions:

    • The indexes are of different types.For example, you can create bitmap and B-tree indexes on the same columns.
    • The indexes use different partitioning schemes.For example, you can create indexes that are locally partitioned and indexes that are globally partitioned.
    • The indexes have different uniqueness properties.For example, you can create both a unique and a non-unique index on the same set of columns.

    For example, a nonpartitioned index, global partitioned index, and locally partitioned index can exist for the same table columns in the same order. Only one index with the same number of columns in the same order can be visible at any one time.

    jboss enterprise application platform training courses malaysia

    This capability enables you to migrate applications without the need to drop an existing index and re-create it with different attributes. Also, this capability is useful in an OLTP database when an index key keeps increasing, causing the database to insert new entries into the same set of index blocks. To alleviate such “hot spots,” you could evolve the index from a nonpartitioned index into a global partitioned index.

    If indexes on the same set of columns do not differ in type or partitioning scheme, then these indexes must use different column permutations. For example, the following SQL statements specify valid column permutations:

    CopyCREATE INDEX employee_idx1 ON employees (last_name, job_id);
    CREATE INDEX employee_idx2 ON employees (job_id, last_name);
  • Keys and Columns

    key is a set of columns or expressions on which you can build an index.

    kubernetes containarization training courses malaysia

    Although the terms are often used interchangeably, indexes and keys are different. Indexes are structures stored in the database that users manage using SQL statements. Keys are strictly a logical concept.

    cloud computing training courses malaysia

    The following statement creates an index on the customer_id column of the sample table oe.orders:

    CopyCREATE INDEX ord_customer_ix ON orders (customer_id);
    

    In the preceding statement, the customer_id column is the index key. The index itself is named ord_customer_ix.

    Note

    Primary and unique keys automatically have indexes, but you might want to create an index on a foreign key.

    ai artificial intelligence training courses malaysia

    See also

    • “Data Integrity”
    • Oracle Database SQL Language Reference CREATE INDEX syntax and semantics

    lean it certification training courses malaysia

  • Index Usability and Visibility

    Indexes are usable (default) or unusable, visible (default) or invisible.

    microsoft certification malaysia

    These properties are defined as follows:

    • UsabilityAn unusable index, which is ignored by the optimizer, is not maintained by DML operations. An unusable index can improve the performance of bulk loads. Instead of dropping an index and later re-creating it, you can make the index unusable and then rebuild it. Unusable indexes and index partitions do not consume space. When you make a usable index unusable, the database drops its index segment.
      juniper certification malaysia
    • VisibilityAn invisible index is maintained by DML operations, but is not used by default by the optimizer. Making an index invisible is an alternative to making it unusable or dropping it. Invisible indexes are especially useful for testing the removal of an index before dropping it or using indexes temporarily without affecting the overall application.
      istqb certification malaysia

    See also

    “Overview of the Optimizer” to learn about how the optimizer select execution plans

    database training courses malaysia