Indexes- Best Practices for SAP HANA

May 21, 2018 | Author: tdeazucar | Category: Database Index, Sql, Relational Database, Databases, Information Technology Management



2160391 – FAQ: SAP HANA IndexesSEPTEMBER 17, 2015 BY SAP HANA WIKI0 COMMENTS 1. What are SAP HANA indexes in the context of this SAP Note? SAP HANA indexes in the context of this SAP Note are data structures on tables, that can provide efficient table data access and / or guarantee uniqueness. This index concept is very common for relational databases. In general the term “index” in SAP HANA can also mean “table” or “data”. For example, the main SAP HANA process “indexserver” obviously works on data in the first place and not on indexes. 2. What is the purpose of indexes in SAP HANA environments? The main reasons for creating indexes in SAP HANA environments are:  Efficient table data access (see SAP Note 2000002)  Efficient support of unique and primary key constraints 3. Which special aspects and limitations have to be considered with indexes? For an efficient index design it is good to know the following aspects and limitations of indexes: Scenario Details Although the index (and the underlying dictionary) provides sorted data, it is not possible to retrieve the minimum or the maximum value directly. Instead the whole data has to be No support of MIN scanned to find the minimum / maximum. Main reason for this and MAX technical restriction is the fact that two separate data areas exist (main and delta storage) and so no globally sorted data set is available. No support of ORDER BY Although the index (and the underlying dictionary) provides sorted data, it is not possible to support an ORDER BY with an index. Instead always an explicit sorting needs to be done. Main reason for this technical restriction is the fact that two separate data areas exist (main and delta storage) and so no globally sorted data set is available. Risk of performance regressions with INVERTED HASH indexes Hash collisions or range conditions on index columns can result in performance regressions when using INVERTED HASH indexes. See SAP Note 2109355 for more details. Where can I find information about existing indexes? Information about indexes is available in the following SAP HANA tables and monitoring views: Table name Details FULLTEXT_INDEXES Fulltext indexes GEOCODE_INDEXES Geocode indexes INDEXES All existing indexes INDEX_COLUMNS Columns of all existing indexes M_CS_INDEXES Column store indexes M_FUZZY_SEARCH_INDEXES Fuzzy search indexes M_RS_INDEXES Row store indexes The following index related SQL statements are available via SAP Note 1969700: SQL statement Details SQL: “HANA_Indexes_Columns” Index columns .Increased Due to the fuzzy content of FULLTEXT indexes the memory memory requirements can be significantly higher than for normal requirements of indexes. BELNR and POSNR. SPARSE columns See SAP Note 2000002 for more information. on column BELNR and on column POSNR. 4. an (unnamed) implicit single column index is created on all individual columns. If for example a primary key is created on columns MANDT. FULLTEXT indexes Indexes on For technical reasons indexes on columns with PREFIXED or PREFIXED and SPARSE compression may not be used for efficient data access. implicit single column indexes are created on column MANDT. may not be used Implicit indexes when creating primary key When a unique or primary index is created on multiple columns of a column store table. see SAP Note 2000002 for more information) Shows redundant single column indexes (which are SQL: “HANA_Indexes_ColumnStore_RedundantIndexes” already implicitly created on columns of primary key or unique indexes) SQL: “HANA_Indexes_HashCollisions” Hash collisions of INVERTED HASH indexes (SAP Note2109355) SQL: “HANA_Indexes_LargestIndexes” Overview of largest indexes SQL: “HANA_RowStore_TotalIndexSize” Calculation of total row store index size and comparison with Pool/RowEngine/CpbTree heap allocator in order to detect memory leak 5. 21093 INVERTED HASH index. Fulltext index CREATE FULLTEXT INDEX ... Maps column dictionary value IDs to .. What kind of indexes exist in SAP HANA environments? The following indexes are available in SAP HANA environments: Store Index type Row store BTREE [UNIQUE] Row store CPBTREE [UNIQUE] Column FULLTEXT store Column INVERTED store HASH [UNIQUE] SAP Note Details Creation command B*tree index on row store table CREATE [UNIQUE] BTREE INDEX . 21126 B*tree index with compressed prefix CREATE [UNIQUE] 04 on row store table CPBTREE INDEX ... more CREATE [UNIQUE] 55 memory efficient alternative INVERTED HASH to INVERTED VALUE indexes INDEX...Shows single column indexes on columns with SPARSE or SQL: PREFIXED compression type “HANA_Indexes_ColumnStore_IndexesOnSparseAndPref (which may not provide xedColumns” performance benefit.. standard column store index that maps value CREATE [UNIQUE] IDs of dictionary to row IDs of INVERTED VALUE column INDEX . 7.. so you should create as few indexes as possible. Single column indexes in column store have much less space overhead..row IDs. no B*tree structure INVERTED VALUE index. so that the space possible overhead is minimized. As small indexes as Specify as few columns as possible in an index. Which general recommendations exist for individually created indexes? The following general recommendations should be considered when creating indexes individually: Recommendation Details As few indexes as possible Every index imposes overhead in terms of space and performance. Therefore you should use Prefer single column single column indexes whenever possible. Are there tools available which automatically suggest useful indexes? While the individual design of secondary indexes is typically an outcome of SQL optimization there are already the following general approaches available to determine useful secondary indexes: Area Details SAP Suite on See SAP Note 1794297 that provides some reports for identifying useful . no B*tree structure INVERTED Column VALUE store [UNIQUE] 6. because they are implemented as rather small additional column data structure. indexes in column Due to the in-memory approach it is typically fine to define an store index only on the most selective column in SAP HANA environments. while on other relational databases often only a multi-column index provides optimal performance. Maps column dictionary value IDs to row IDs. On a CONCAT attribute columns also an inverted index is created. How are indexes stored in column store? Single-column indexes in column store are rather light-weight data structures on top of the column is a Python script that identifies useful indexes. so called inverted indexes. SAP Bank Analyzer See SAP Note 2015986 for general suggestions on index design in Bank Analyzer environments. recreated during column load 06 . Drop DROP INDEX "<index_name>" ALTER INDEX "<index_name>" REBUILD Rebuild Only relevant for row store. See SAP Note 1986747 for more information how multi-column indexes are stored as internal columns. Multi-column indexes in column store are stored as internal columns. Are indexes persisted to disk? The following overview shows which kind of indexes are persisted to disk: Store Index type Multi Column column store indexes SP Detail S <= Only maintained in memory. Rename RENAME INDEX "<index_name>" TO "<new_index_name>" 9. 8.. just like for columns being used by a single-column index.HANA indexes. as column store indexes are automatically rebuilt during delta merge operations.. General $DIR_INSTANCE/exe/python_support/indexAdvisor.. 10. INDEX "<index_name>" ON "<table_name>" .. Which DDL operations can be performed on indexes? Important DDL operations on indexes are: Operati Command on Create CREATE . so called CONCAT attributes. Single Column column store indexes Only maintained in memory. Where can I see if an indexes is used by a certain SQL statement? This information is available via PlanViz (see SAP Note 2073964). This mapping from the dictionary value ID to the related table row IDs is only available via an index (“inverted index”). The following picture illustrates the direct mapping of dictionary value IDs to table row IDs via an inverted index (right hand side): 12. Without index. 70 caused by persisted indexes. but slower load times). recreated during column load Row store Only maintained in memory. the whole column has to be scanned for a specific value. but it doesn’t contain the information. in which rows of the table a certain value exists. Example: (inverted index on column X used for access) . SAP Note1976994 describes a wrong result set bug with Rev. Why do I need single column indexes on column store tables although the column dictionary is already sorted? The column dictionary contains the existing column values in a sorted way. If set to ‘false’ CONCAT attributes are not persisted to disk and recreated during column load (less disk space requirements.Column specific inverted index structures recreated during load The following parameter controls if CONCAT attributes are persisted to disk: Parameter Defa Details ult >= 07 attributes. recreated during startup 11. but quicker load times).ini -> [global] -> runtime_structure_persiste true nce If set to ‘true’ CONCAT attributes are persisted to disk (increased disk space requirements. and the allocated space is in the first place purely linked to the underlying table. TREX external key. . see SAP Note1986747). DBA_SEGMENTS entries with SEGMENT_TYPE = ‘INDEX’ on Oracle).13. indexes are extensions to column structures (inverted indexes) or internal columns (e. Are indexes dedicated storage objects? On other databases administrators are used to consider indexes as dedicated storage objects like segments (e.g. CONCAT attributes. Only with specific analysis tools like SQL: “HANA_Tables_LargestTables” or SQL: “HANA_Indexes_LargestIndexes” (SAP Note1969700) it is possible to understand better how much space is allocated by index structure. This doesn’t apply for SAP HANA. As already seen above.g.
Copyright © 2022 DOKUMEN.SITE Inc.