Cost_based_optimizer.md.json 43 KB

1234567891011121314151617
  1. {
  2. "5d214ec701657c47f459029b0795af71fb882ee8ab0e44041ad4544751ec02a0": {
  3. "original": "# Cost-based optimizer\n\nWhen Manticore executes a fullscan query, it can either use a plain scan to check every document against the filters or employ additional data and/or algorithms to speed up query execution. Manticore uses a cost-based optimizer (CBO), also known as a \"query optimizer\" to determine which approach to take.\n\nThe CBO can also enhance the performance of full-text queries. See below for more details.\n\nThe CBO may decide to replace one or more query filters with one of the following entities if it determines that doing so will improve performance:\n\n1. A **docid index** utilizes a special docid-only secondary index stored in files with the `.spt` extension. Besides improving filters on document IDs, the docid index is also used to accelerate document ID to row ID lookups and to speed up the application of large killlists during daemon startup.\n2. A **columnar scan** relies on columnar storage and can only be used on a columnar attribute. It scans every value and tests it against the filter, but it is heavily optimized and is typically faster than the default approach.\n3. **Secondary indexes** are generated for all attributes (except JSON) by default. They use the [PGM index](https://pgm.di.unipi.it/) along with Manticore's built-in inverted index to retrieve the list of row IDs corresponding to a value or range of values. Secondary indexes are stored in files with the `.spidx` and `.spjidx` extensions.\nFor information on how to generate secondary indexes over JSON attributes, see [json_secondary_indexes](../Creating_a_table/Local_tables/Plain_and_real-time_table_settings.md#json_secondary_indexes).\n\nThe optimizer estimates the cost of each execution path using various attribute statistics, including:\n\n1. Information on the data distribution within an attribute (histograms, stored in `.sphi` files). Histograms are generated automatically when data is indexed and serve as the primary source of information for the CBO.\n2. Information from PGM (secondary indexes), which helps estimate the number of document lists to read. This assists in gauging doclist merge performance and in selecting the appropriate merge algorithm (priority queue merge or bitmap merge).\n3. Columnar encoding statistics, employed to estimate columnar data decompression performance.\n4. A columnar min-max tree. While the CBO uses histograms to estimate the number of documents left after applying the filter, it also needs to determine how many documents the filter had to process. For columnar attributes, partial evaluation of the min-max tree serves this purpose.\n5. Full-text dictionary. The CBO utilizes term stats to estimate the cost of evaluating the full-text tree.\n\nThe optimizer computes the execution cost for every filter used in a query. Since certain filters can be replaced with several different entities (e.g., for a document id, Manticore can use a plain scan, a docid index lookup, a columnar scan (if the document id is columnar), and a secondary index), the optimizer evaluates all available combinations. However, there is a maximum limit of 1024 combinations.\n\nTo estimate query execution costs, the optimizer calculates the estimated costs of the most significant operations performed when executing the query. It uses preset constants to represent the cost of each operation.\n\nThe optimizer compares the costs of each execution path and chooses the path with the lowest cost to execute the query.\n\nWhen working with full-text queries that have filters by attributes, the query optimizer decides between two possible execution paths. One is to execute the full-text query, retrieve the matches, and use filters. The other is to replace filters with one or more entities described above, fetch rowids from them, and inject them into the full-text matching tree. This way, full-text search results will intersect with full-scan results. The query optimizer estimates the cost of full-text tree evaluation and the best possible path for computing filter results. Using this information, the optimizer chooses the execution path.\n\nAnother factor to consider is multithreaded query execution (when `pseudo_sharding` is enabled). The CBO is aware that some queries can be executed in multiple threads and takes this into account. The CBO prioritizes shorter query execution times (i.e., latency) over throughput. For instance, if a query using a columnar scan can be executed in multiple threads (and occupy multiple CPU cores) and is faster than a query executed in a single thread using secondary indexes, multithreaded execution will be preferred.\n\nQueries using secondary indexes and docid indexes always run in a single thread, as benchmarks indicate that there is little to no benefit in making them multithreaded.\n\nAt present, the optimizer only uses CPU costs and does not take memory or disk usage into account.\n\n<!-- proofread -->\n\n",
  4. "translations": {
  5. "chinese": "# \u57fa\u4e8e\u4ee3\u4ef7\u7684\u4f18\u5316\u5668\n\n\u5f53 Manticore \u6267\u884c\u5168\u626b\u63cf\u67e5\u8be2\u65f6\uff0c\u5b83\u53ef\u4ee5\u4f7f\u7528\u666e\u901a\u626b\u63cf\u68c0\u67e5\u6bcf\u4e2a\u6587\u6863\u662f\u5426\u7b26\u5408\u8fc7\u6ee4\u6761\u4ef6\uff0c\u6216\u8005\u91c7\u7528\u989d\u5916\u7684\u6570\u636e\u548c/\u6216\u7b97\u6cd5\u6765\u52a0\u5feb\u67e5\u8be2\u6267\u884c\u901f\u5ea6\u3002Manticore \u4f7f\u7528\u57fa\u4e8e\u4ee3\u4ef7\u7684\u4f18\u5316\u5668\uff08CBO\uff09\uff0c\u4e5f\u79f0\u4e3a\u201c\u67e5\u8be2\u4f18\u5316\u5668\u201d\uff0c\u6765\u786e\u5b9a\u91c7\u7528\u54ea\u79cd\u65b9\u5f0f\u3002\n\nCBO \u8fd8\u53ef\u4ee5\u63d0\u5347\u5168\u6587\u67e5\u8be2\u7684\u6027\u80fd\u3002\u8be6\u89c1\u4e0b\u6587\u3002\n\n\u5982\u679c CBO \u5224\u65ad\u67d0\u4e9b\u63aa\u65bd\u80fd\u591f\u63d0\u5347\u6027\u80fd\uff0c\u5b83\u53ef\u80fd\u51b3\u5b9a\u5c06\u4e00\u4e2a\u6216\u591a\u4e2a\u67e5\u8be2\u8fc7\u6ee4\u5668\u66ff\u6362\u4e3a\u4ee5\u4e0b\u5b9e\u4f53\u4e4b\u4e00\uff1a\n\n1. **docid \u7d22\u5f15** \u5229\u7528\u4e00\u79cd\u7279\u6b8a\u7684\u4ec5\u5305\u542b docid \u7684\u4e8c\u7ea7\u7d22\u5f15\uff0c\u5b58\u50a8\u5728\u6269\u5c55\u540d\u4e3a `.spt` \u7684\u6587\u4ef6\u4e2d\u3002\u9664\u4e86\u63d0\u5347\u6587\u6863 ID \u8fc7\u6ee4\u5668\u7684\u6027\u80fd\u5916\uff0cdocid \u7d22\u5f15\u8fd8\u7528\u4e8e\u52a0\u901f\u6587\u6863 ID \u5230\u884c ID \u7684\u67e5\u627e\uff0c\u5e76\u52a0\u5feb\u5b88\u62a4\u8fdb\u7a0b\u542f\u52a8\u65f6\u5927\u91cf killlist \u7684\u5e94\u7528\u3002\n2. **\u5217\u5f0f\u626b\u63cf** \u4f9d\u8d56\u4e8e\u5217\u5f0f\u5b58\u50a8\uff0c\u53ea\u80fd\u7528\u4e8e\u5217\u5f0f\u5c5e\u6027\u3002\u5b83\u626b\u63cf\u6bcf\u4e2a\u503c\u5e76\u5bf9\u5176\u5e94\u7528\u8fc7\u6ee4\u5668\uff0c\u4f46\u8fdb\u884c\u4e86\u9ad8\u5ea6\u4f18\u5316\uff0c\u901a\u5e38\u6bd4\u9ed8\u8ba4\u65b9\u6cd5\u66f4\u5feb\u3002\n3. **\u4e8c\u7ea7\u7d22\u5f15** \u9ed8\u8ba4\u4e3a\u6240\u6709\u5c5e\u6027\uff08\u9664 JSON \u5916\uff09\u751f\u6210\u3002\u5b83\u4eec\u4f7f\u7528 [PGM \u7d22\u5f15](https://pgm.di.unipi.it/) \u4ee5\u53ca Manticore \u5185\u7f6e\u7684\u5012\u6392\u7d22\u5f15\u6765\u68c0\u7d22\u5bf9\u5e94\u67d0\u4e2a\u503c\u6216\u503c\u8303\u56f4\u7684\u884c ID \u5217\u8868\u3002\u4e8c\u7ea7\u7d22\u5f15\u5b58\u50a8\u5728\u6269\u5c55\u540d\u4e3a `.spidx` \u548c `.spjidx` \u7684\u6587\u4ef6\u4e2d\u3002\n\u6709\u5173\u5982\u4f55\u4e3a JSON \u5c5e\u6027\u751f\u6210\u4e8c\u7ea7\u7d22\u5f15\u7684\u4fe1\u606f\uff0c\u8bf7\u53c2\u89c1 [json_secondary_indexes](../Creating_a_table/Local_tables/Plain_and_real-time_table_settings.md#json_secondary_indexes)\u3002\n\n\u4f18\u5316\u5668\u5229\u7528\u5404\u79cd\u5c5e\u6027\u7edf\u8ba1\u4fe1\u606f\u4f30\u7b97\u6bcf\u6761\u6267\u884c\u8def\u5f84\u7684\u4ee3\u4ef7\uff0c\u5305\u62ec\uff1a\n\n1. \u5173\u4e8e\u5c5e\u6027\u5185\u6570\u636e\u5206\u5e03\u7684\u4fe1\u606f\uff08\u76f4\u65b9\u56fe\uff0c\u5b58\u50a8\u5728 `.sphi` \u6587\u4ef6\u4e2d\uff09\u3002\u76f4\u65b9\u56fe\u5728\u6570\u636e\u5efa\u7acb\u7d22\u5f15\u65f6\u81ea\u52a8\u751f\u6210\uff0c\u662f CBO \u7684\u4e3b\u8981\u4fe1\u606f\u6765\u6e90\u3002\n2. PGM\uff08\u4e8c\u7ea7\u7d22\u5f15\uff09\u4fe1\u606f\uff0c\u6709\u52a9\u4e8e\u4f30\u7b97\u9700\u8981\u8bfb\u53d6\u7684\u6587\u6863\u5217\u8868\u6570\u91cf\u3002\u8fd9\u6709\u52a9\u4e8e\u8bc4\u4f30\u6587\u6863\u5217\u8868\u5408\u5e76\u6027\u80fd\u53ca\u9009\u62e9\u5408\u9002\u7684\u5408\u5e76\u7b97\u6cd5\uff08\u4f18\u5148\u961f\u5217\u5408\u5e76\u6216\u4f4d\u56fe\u5408\u5e76\uff09\u3002\n3. \u5217\u5f0f\u7f16\u7801\u7edf\u8ba1\u6570\u636e\uff0c\u7528\u4e8e\u4f30\u7b97\u5217\u5f0f\u6570\u636e\u89e3\u538b\u6027\u80fd\u3002\n4. \u5217\u5f0f\u6700\u5c0f-\u6700\u5927\u6811\u3002CBO \u4f7f\u7528\u76f4\u65b9\u56fe\u4f30\u7b97\u5e94\u7528\u8fc7\u6ee4\u5668\u540e\u5269\u4f59\u7684\u6587\u6863\u6570\uff0c\u540c\u65f6\u9700\u8981\u786e\u5b9a\u8fc7\u6ee4\u5668\u5904\u7406\u8fc7\u7684\u6587\u6863\u6570\u3002\u5bf9\u4e8e\u5217\u5f0f\u5c5e\u6027\uff0c\u90e8\u5206\u8bc4\u4f30\u6700\u5c0f-\u6700\u5927\u6811\u7528\u4e8e\u6b64\u76ee\u7684\u3002\n5. \u5168\u6587\u5b57\u5178\u3002CBO \u5229\u7528\u8bcd\u9879\u7edf\u8ba1\u4fe1\u606f\u4f30\u7b97\u5168\u6587\u6811\u8bc4\u4f30\u4ee3\u4ef7\u3002\n\n\u4f18\u5316\u5668\u8ba1\u7b97\u67e5\u8be2\u4e2d\u6bcf\u4e2a\u8fc7\u6ee4\u5668\u7684\u6267\u884c\u4ee3\u4ef7\u3002\u7531\u4e8e\u67d0\u4e9b\u8fc7\u6ee4\u5668\u53ef\u4ee5\u88ab\u591a\u79cd\u5b9e\u4f53\u66ff\u4ee3\uff08\u4f8b\u5982\uff0c\u5bf9\u4e8e\u6587\u6863 ID\uff0cManticore \u53ef\u7528\u666e\u901a\u626b\u63cf\u3001docid \u7d22\u5f15\u67e5\u627e\u3001\u5217\u5f0f\u626b\u63cf\uff08\u5982\u679c\u6587\u6863 ID \u662f\u5217\u5f0f\u7684\uff09\u4ee5\u53ca\u4e8c\u7ea7\u7d22\u5f15\uff09\uff0c\u4f18\u5316\u5668\u4f1a\u8bc4\u4f30\u6240\u6709\u53ef\u7528\u7ec4\u5408\u3002\u4f46\u7ec4\u5408\u6570\u6700\u5927\u9650\u5236\u4e3a 1024\u3002\n\n\u4e3a\u4f30\u7b97\u67e5\u8be2\u6267\u884c\u4ee3\u4ef7\uff0c\u4f18\u5316\u5668\u8ba1\u7b97\u6267\u884c\u67e5\u8be2\u65f6\u6240\u6267\u884c\u7684\u6700\u91cd\u8981\u64cd\u4f5c\u7684\u9884\u4f30\u4ee3\u4ef7\u3002\u5b83\u91c7\u7528\u9884\u8bbe\u5e38\u6570\u4ee3\u8868\u6bcf\u4e2a\u64cd\u4f5c\u7684\u4ee3\u4ef7\u3002\n\n\u4f18\u5316\u5668\u5bf9\u6bd4\u5404\u6267\u884c\u8def\u5f84\u7684\u4ee3\u4ef7\uff0c\u9009\u62e9\u4ee3\u4ef7\u6700\u4f4e\u7684\u8def\u5f84\u4ee5\u6267\u884c\u67e5\u8be2\u3002\n\n\u5f53\u5904\u7406\u5e26\u6709\u5c5e\u6027\u8fc7\u6ee4\u5668\u7684\u5168\u6587\u67e5\u8be2\u65f6\uff0c\u67e5\u8be2\u4f18\u5316\u5668\u5728\u4e24\u6761\u53ef\u80fd\u7684\u6267\u884c\u8def\u5f84\u95f4\u505a\u51fa\u51b3\u5b9a\u3002\u4e00\u79cd\u662f\u6267\u884c\u5168\u6587\u67e5\u8be2\uff0c\u83b7\u53d6\u5339\u914d\u7ed3\u679c\u5e76\u5e94\u7528\u8fc7\u6ee4\u5668\uff1b\u53e6\u4e00\u79cd\u662f\u7528\u4e0a\u8ff0\u4e00\u4e2a\u6216\u591a\u4e2a\u5b9e\u4f53\u66ff\u6362\u8fc7\u6ee4\u5668\uff0c\u4ece\u4e2d\u83b7\u53d6\u884c ID \u5e76\u6ce8\u5165\u5168\u6587\u5339\u914d\u6811\u3002\u8fd9\u6837\uff0c\u5168\u6587\u641c\u7d22\u7ed3\u679c\u4f1a\u4e0e\u5168\u626b\u63cf\u7ed3\u679c\u53d6\u4ea4\u96c6\u3002\u67e5\u8be2\u4f18\u5316\u5668\u4f30\u7b97\u5168\u6587\u6811\u8bc4\u4f30\u6210\u672c\u548c\u8ba1\u7b97\u8fc7\u6ee4\u5668\u7ed3\u679c\u7684\u6700\u4f73\u8def\u5f84\uff0c\u5229\u7528\u8fd9\u4e9b\u4fe1\u606f\u9009\u62e9\u6267\u884c\u8def\u5f84\u3002\n\n\u53e6\u4e00\u4e2a\u8003\u8651\u56e0\u7d20\u662f\u591a\u7ebf\u7a0b\u67e5\u8be2\u6267\u884c\uff08\u5f53\u542f\u7528 `pseudo_sharding` \u65f6\uff09\u3002CBO \u610f\u8bc6\u5230\u67d0\u4e9b\u67e5\u8be2\u53ef\u5e76\u53d1\u6267\u884c\uff0c\u5e76\u5c06\u5176\u7eb3\u5165\u8003\u91cf\u3002CBO \u4f18\u5148\u8003\u8651\u66f4\u77ed\u7684\u67e5\u8be2\u6267\u884c\u65f6\u95f4\uff08\u5373\u5ef6\u8fdf\uff09\u80dc\u8fc7\u541e\u5410\u91cf\u3002\u4f8b\u5982\uff0c\u5982\u679c\u4f7f\u7528\u5217\u5f0f\u626b\u63cf\u7684\u67e5\u8be2\u80fd\u5728\u591a\u7ebf\u7a0b\uff08\u5360\u7528\u591a\u4e2a CPU \u6838\u5fc3\uff09\u4e2d\u6267\u884c\uff0c\u4e14\u6bd4\u5355\u7ebf\u7a0b\u4f7f\u7528\u4e8c\u7ea7\u7d22\u5f15\u7684\u67e5\u8be2\u66f4\u5feb\uff0c\u5219\u4f18\u5148\u591a\u7ebf\u7a0b\u6267\u884c\u3002\n\n\u4f7f\u7528\u4e8c\u7ea7\u7d22\u5f15\u548c docid \u7d22\u5f15\u7684\u67e5\u8be2\u59cb\u7ec8\u5355\u7ebf\u7a0b\u6267\u884c\uff0c\u56e0\u4e3a\u57fa\u51c6\u6d4b\u8bd5\u8868\u660e\u5b83\u4eec\u591a\u7ebf\u7a0b\u6267\u884c\u51e0\u4e4e\u65e0\u76ca\u3002\n\n\u76ee\u524d\uff0c\u4f18\u5316\u5668\u4ec5\u8003\u8651 CPU \u4ee3\u4ef7\uff0c\u4e0d\u8003\u8651\u5185\u5b58\u6216\u78c1\u76d8\u4f7f\u7528\u3002 \n\n<!-- proofread -->",
  6. "russian": "# \u041e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0442\u043e\u0440 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0441\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u0438\n\n\u041a\u043e\u0433\u0434\u0430 Manticore \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u043f\u043e\u043b\u043d\u043e\u0441\u043a\u0430\u043d\u0438\u0440\u0443\u044e\u0449\u0438\u0439 \u0437\u0430\u043f\u0440\u043e\u0441, \u043e\u043d \u043c\u043e\u0436\u0435\u0442 \u043b\u0438\u0431\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0441\u043a\u0430\u043d \u0434\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430 \u0441 \u0443\u0447\u0451\u0442\u043e\u043c \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432, \u043b\u0438\u0431\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438/\u0438\u043b\u0438 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b \u0434\u043b\u044f \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430. Manticore \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0442\u043e\u0440 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0441\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u0438 (CBO), \u0442\u0430\u043a\u0436\u0435 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0439 \u043a\u0430\u043a \u00ab\u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0442\u043e\u0440 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432\u00bb, \u0434\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0435\u0433\u043e \u0441\u043f\u043e\u0441\u043e\u0431\u0430.\n\nCBO \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u0435\u0442 \u0443\u043b\u0443\u0447\u0448\u0430\u0442\u044c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u043b\u043d\u043e\u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u0441\u043c. \u043d\u0438\u0436\u0435.\n\nCBO \u043c\u043e\u0436\u0435\u0442 \u0440\u0435\u0448\u0438\u0442\u044c \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u043e\u0434\u0438\u043d \u0438\u043b\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043e\u0434\u043d\u0438\u043c \u0438\u0437 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432, \u0435\u0441\u043b\u0438 \u043e\u043d \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442, \u0447\u0442\u043e \u044d\u0442\u043e \u0443\u043b\u0443\u0447\u0448\u0438\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c:\n\n1. **docid \u0438\u043d\u0434\u0435\u043a\u0441** \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u0432\u0442\u043e\u0440\u0438\u0447\u043d\u044b\u0439 \u0438\u043d\u0434\u0435\u043a\u0441 \u0442\u043e\u043b\u044c\u043a\u043e docid, \u0445\u0440\u0430\u043d\u044f\u0449\u0438\u0439\u0441\u044f \u0432 \u0444\u0430\u0439\u043b\u0430\u0445 \u0441 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435\u043c `.spt`. \u041f\u043e\u043c\u0438\u043c\u043e \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u044f \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432 \u043f\u043e \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430\u043c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432, docid \u0438\u043d\u0434\u0435\u043a\u0441 \u0442\u0430\u043a\u0436\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430 \u0441\u0442\u0440\u043e\u043a\u0438 \u043f\u043e \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0443 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430 \u0438 \u0434\u043b\u044f \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u044f \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0431\u043e\u043b\u044c\u0448\u0438\u0445 killlist \u043f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u0434\u0435\u043c\u043e\u043d\u0430.\n2. **\u043a\u043e\u043b\u043e\u043d\u043e\u0447\u043d\u043e\u0435 \u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435** \u043e\u043f\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u043a\u043e\u043b\u043e\u043d\u043e\u0447\u043d\u043e\u0435 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0438 \u043c\u043e\u0436\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u043a\u043e\u043b\u043e\u043d\u043e\u0447\u043d\u043e\u043c \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0435. \u041e\u043d\u043e \u0441\u043a\u0430\u043d\u0438\u0440\u0443\u0435\u0442 \u043a\u0430\u0436\u0434\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u0435\u0433\u043e \u043f\u043e \u0444\u0438\u043b\u044c\u0442\u0440\u0443, \u043d\u043e \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0441\u0438\u043b\u044c\u043d\u043e \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043e \u0438 \u043e\u0431\u044b\u0447\u043d\u043e \u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u0430 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e.\n3. **\u0432\u0442\u043e\u0440\u0438\u0447\u043d\u044b\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u044b** \u0441\u043e\u0437\u0434\u0430\u044e\u0442\u0441\u044f \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 (\u043a\u0440\u043e\u043c\u0435 JSON). \u041e\u043d\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 [PGM \u0438\u043d\u0434\u0435\u043a\u0441](https://pgm.di.unipi.it/) \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u043c \u0438\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u043c Manticore \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0441\u043f\u0438\u0441\u043a\u0430 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u043e\u0432 \u0441\u0442\u0440\u043e\u043a, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044e \u0438\u043b\u0438 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0443 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439. \u0412\u0442\u043e\u0440\u0438\u0447\u043d\u044b\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u044b \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u0432 \u0444\u0430\u0439\u043b\u0430\u0445 \u0441 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f\u043c\u0438 `.spidx` \u0438 `.spjidx`.\n\u0414\u043b\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0432\u0442\u043e\u0440\u0438\u0447\u043d\u044b\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u044b \u043f\u043e JSON \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430\u043c, \u0441\u043c. [json_secondary_indexes](../Creating_a_table/Local_tables/Plain_and_real-time_table_settings.md#json_secondary_indexes).\n\n\u041e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0442\u043e\u0440 \u043e\u0446\u0435\u043d\u0438\u0432\u0430\u0435\u0442 \u0441\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u044c \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043f\u0443\u0442\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0438 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432, \u0432\u043a\u043b\u044e\u0447\u0430\u044f:\n\n1. \u0418\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432\u043d\u0443\u0442\u0440\u0438 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430 (\u0433\u0438\u0441\u0442\u043e\u0433\u0440\u0430\u043c\u043c\u044b, \u0445\u0440\u0430\u043d\u044f\u0449\u0438\u0435\u0441\u044f \u0432 \u0444\u0430\u0439\u043b\u0430\u0445 `.sphi`). \u0413\u0438\u0441\u0442\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0441\u043e\u0437\u0434\u0430\u044e\u0442\u0441\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u0440\u0438 \u0438\u043d\u0434\u0435\u043a\u0441\u0430\u0446\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0441\u043b\u0443\u0436\u0430\u0442 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u043c \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u043e\u043c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0434\u043b\u044f CBO.\n2. \u0418\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e\u0442 PGM (\u0432\u0442\u043e\u0440\u0438\u0447\u043d\u044b\u0445 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u0432), \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u043e\u0446\u0435\u043d\u0438\u0442\u044c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u043f\u0438\u0441\u043a\u043e\u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f. \u042d\u0442\u043e \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u043e\u0446\u0435\u043d\u0438\u0442\u044c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f doclist \u0438 \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0441\u043b\u0438\u044f\u043d\u0438\u044f (\u0441\u043b\u0438\u044f\u043d\u0438\u0435 \u0441 \u043f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442\u043d\u043e\u0439 \u043e\u0447\u0435\u0440\u0435\u0434\u044c\u044e \u0438\u043b\u0438 \u0441\u043b\u0438\u044f\u043d\u0438\u0435 \u0431\u0438\u0442\u043c\u0430\u043f\u043e\u0432).\n3. \u0421\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0443 \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u043e\u043b\u043e\u043d\u043e\u043a, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0443\u044e \u0434\u043b\u044f \u043e\u0446\u0435\u043d\u043a\u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0434\u0435\u043a\u043e\u043c\u043f\u0440\u0435\u0441\u0441\u0438\u0438 \u043a\u043e\u043b\u043e\u043d\u043e\u0447\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445.\n4. \u041a\u043e\u043b\u043e\u043d\u043e\u0447\u043d\u043e\u0435 \u0434\u0435\u0440\u0435\u0432\u043e min-max. \u0412 \u0442\u043e \u0432\u0440\u0435\u043c\u044f \u043a\u0430\u043a CBO \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0433\u0438\u0441\u0442\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0434\u043b\u044f \u043e\u0446\u0435\u043d\u043a\u0438 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432, \u043e\u0441\u0442\u0430\u044e\u0449\u0438\u0445\u0441\u044f \u043f\u043e\u0441\u043b\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0444\u0438\u043b\u044c\u0442\u0440\u0430, \u043e\u043d \u0442\u0430\u043a\u0436\u0435 \u0434\u043e\u043b\u0436\u0435\u043d \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0444\u0438\u043b\u044c\u0442\u0440 \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c. \u0414\u043b\u044f \u043a\u043e\u043b\u043e\u043d\u043e\u0447\u043d\u044b\u0445 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 \u0447\u0430\u0441\u0442\u0438\u0447\u043d\u0430\u044f \u043e\u0446\u0435\u043d\u043a\u0430 min-max \u0434\u0435\u0440\u0435\u0432\u0430 \u0441\u043b\u0443\u0436\u0438\u0442 \u044d\u0442\u043e\u0439 \u0446\u0435\u043b\u0438.\n5. \u041f\u043e\u043b\u043d\u043e\u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0439 \u0441\u043b\u043e\u0432\u0430\u0440\u044c. CBO \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0443 \u0442\u0435\u0440\u043c\u0438\u043d\u043e\u0432 \u0434\u043b\u044f \u043e\u0446\u0435\u043d\u043a\u0438 \u0441\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u0438 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u043d\u043e\u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u0434\u0435\u0440\u0435\u0432\u0430.\n\n\u041e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0442\u043e\u0440 \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442 \u0441\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0444\u0438\u043b\u044c\u0442\u0440\u0430, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u043e\u0433\u043e \u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u0435. \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0444\u0438\u043b\u044c\u0442\u0440\u044b \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0437\u0430\u043c\u0435\u043d\u0435\u043d\u044b \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c\u0438 \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c\u0438 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043b\u044f \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430 Manticore \u043c\u043e\u0436\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0441\u043a\u0430\u043d, \u043f\u043e\u0438\u0441\u043a \u043f\u043e docid \u0438\u043d\u0434\u0435\u043a\u0441\u0443, \u043a\u043e\u043b\u043e\u043d\u043e\u0447\u043d\u043e\u0435 \u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 (\u0435\u0441\u043b\u0438 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430 \u043a\u043e\u043b\u043e\u043d\u043e\u0447\u043d\u044b\u0439) \u0438 \u0432\u0442\u043e\u0440\u0438\u0447\u043d\u044b\u0439 \u0438\u043d\u0434\u0435\u043a\u0441), \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0442\u043e\u0440 \u043e\u0446\u0435\u043d\u0438\u0432\u0430\u0435\u0442 \u0432\u0441\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0435 \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u0438. \u041e\u0434\u043d\u0430\u043a\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u043b\u0438\u043c\u0438\u0442 \u0432 1024 \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u0438.\n\n\u0414\u043b\u044f \u043e\u0446\u0435\u043d\u043a\u0438 \u0441\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0442\u043e\u0440 \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u043c\u044b\u0435 \u0441\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u0438 \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0437\u043d\u0430\u0447\u0438\u043c\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439, \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u0445 \u043f\u0440\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0430. \u041e\u043d \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u043f\u0440\u0435\u0434\u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b \u0434\u043b\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u0438 \u043a\u0430\u0436\u0434\u043e\u0439 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438.\n\n\u041e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0442\u043e\u0440 \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u0435\u0442 \u0441\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u0438 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043f\u0443\u0442\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0438 \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u0442 \u043f\u0443\u0442\u044c \u0441 \u043d\u0430\u0438\u043c\u0435\u043d\u044c\u0448\u0435\u0439 \u0441\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u044c\u044e \u0434\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430.\n\n\u041f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u043f\u043e\u043b\u043d\u043e\u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u043c\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0430\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442 \u0444\u0438\u043b\u044c\u0442\u0440\u044b \u043f\u043e \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430\u043c, \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0442\u043e\u0440 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u0442 \u043e\u0434\u0438\u043d \u0438\u0437 \u0434\u0432\u0443\u0445 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 \u043f\u0443\u0442\u0435\u0439 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f. \u041b\u0438\u0431\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043f\u043e\u043b\u043d\u043e\u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441, \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u044f \u0438 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u0444\u0438\u043b\u044c\u0442\u0440\u044b. \u041b\u0438\u0431\u043e \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u0444\u0438\u043b\u044c\u0442\u0440\u044b \u043e\u0434\u043d\u0438\u043c \u0438\u043b\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c\u0438, \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u043c\u0438 \u0432\u044b\u0448\u0435, \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0438\u0437 \u043d\u0438\u0445 rowid \u0438 \u0432\u043d\u0435\u0434\u0440\u0438\u0442\u044c \u0438\u0445 \u0432 \u043f\u043e\u043b\u043d\u043e\u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u0435 \u0434\u0435\u0440\u0435\u0432\u043e. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043f\u043e\u043b\u043d\u043e\u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u0438\u0441\u043a\u0430 \u043f\u0435\u0440\u0435\u0441\u0435\u043a\u0443\u0442\u0441\u044f \u0441 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u043c\u0438 \u043f\u043e\u043b\u043d\u043e\u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f. \u041e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0442\u043e\u0440 \u043e\u0446\u0435\u043d\u0438\u0432\u0430\u0435\u0442 \u0441\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u044c \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u043d\u043e\u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u0434\u0435\u0440\u0435\u0432\u0430 \u0438 \u043d\u0430\u0438\u043b\u0443\u0447\u0448\u0438\u0439 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0439 \u043f\u0443\u0442\u044c \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u0444\u0438\u043b\u044c\u0442\u0440\u0430. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u044d\u0442\u0443 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e, \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0442\u043e\u0440 \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u0442 \u043f\u0443\u0442\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f.\n\n\u0415\u0449\u0451 \u043e\u0434\u0438\u043d \u0444\u0430\u043a\u0442\u043e\u0440 \u2014 \u043c\u043d\u043e\u0433\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u043e\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 (\u043a\u043e\u0433\u0434\u0430 \u0432\u043a\u043b\u044e\u0447\u0451\u043d `pseudo_sharding`). CBO \u0437\u043d\u0430\u0435\u0442, \u0447\u0442\u043e \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043c\u043e\u0433\u0443\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c\u0441\u044f \u0432 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043f\u043e\u0442\u043e\u043a\u0430\u0445, \u0438 \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442 \u044d\u0442\u043e. CBO \u043e\u0442\u0434\u0430\u0451\u0442 \u043f\u0440\u0435\u0434\u043f\u043e\u0447\u0442\u0435\u043d\u0438\u0435 \u0431\u043e\u043b\u0435\u0435 \u043a\u043e\u0440\u043e\u0442\u043a\u043e\u043c\u0443 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430 (\u0442\u043e \u0435\u0441\u0442\u044c \u0437\u0430\u0434\u0435\u0440\u0436\u043a\u0435) \u043f\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044e \u0441 \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u043d\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u044c\u044e. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0435\u0441\u043b\u0438 \u0437\u0430\u043f\u0440\u043e\u0441 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043a\u043e\u043b\u043e\u043d\u043e\u0447\u043d\u043e\u0433\u043e \u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d \u0432 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043f\u043e\u0442\u043e\u043a\u0430\u0445 (\u0438 \u0437\u0430\u043d\u044f\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u044f\u0434\u0435\u0440 CPU) \u0438 \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0431\u044b\u0441\u0442\u0440\u0435\u0435, \u0447\u0435\u043c \u0437\u0430\u043f\u0440\u043e\u0441, \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u044b\u0439 \u0432 \u043e\u0434\u043d\u043e\u043c \u043f\u043e\u0442\u043e\u043a\u0435 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0432\u0442\u043e\u0440\u0438\u0447\u043d\u044b\u0445 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u0432, \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0435\u0434\u043f\u043e\u0447\u0442\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c \u043c\u043d\u043e\u0433\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u043e\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435.\n\n\u0417\u0430\u043f\u0440\u043e\u0441\u044b \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0432\u0442\u043e\u0440\u0438\u0447\u043d\u044b\u0445 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u0432 \u0438 docid \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u0432 \u0432\u0441\u0435\u0433\u0434\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u0432 \u043e\u0434\u043d\u043e\u043c \u043f\u043e\u0442\u043e\u043a\u0435, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0431\u0435\u043d\u0447\u043c\u0430\u0440\u043a\u0438 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442, \u0447\u0442\u043e \u043c\u043d\u043e\u0433\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c \u0434\u043b\u044f \u043d\u0438\u0445 \u043c\u0430\u043b\u043e\u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u0430.\n\n\u041d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0442\u043e\u0440 \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u0442\u0440\u0430\u0442\u044b CPU \u0438 \u043d\u0435 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0432\u043e \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0430\u043c\u044f\u0442\u0438 \u0438\u043b\u0438 \u0434\u0438\u0441\u043a\u0430.\n\n<!-- proofread -->"
  7. },
  8. "is_code_or_comment": false,
  9. "model": "openai:gpt-4.1-mini",
  10. "updated_at": 1766339799
  11. },
  12. "__meta": {
  13. "source_text": "# Cost-based optimizer\n\nWhen Manticore executes a fullscan query, it can either use a plain scan to check every document against the filters or employ additional data and/or algorithms to speed up query execution. Manticore uses a cost-based optimizer (CBO), also known as a \"query optimizer\" to determine which approach to take.\n\nThe CBO can also enhance the performance of full-text queries. See below for more details.\n\nThe CBO may decide to replace one or more query filters with one of the following entities if it determines that doing so will improve performance:\n\n1. A **docid index** utilizes a special docid-only secondary index stored in files with the `.spt` extension. Besides improving filters on document IDs, the docid index is also used to accelerate document ID to row ID lookups and to speed up the application of large killlists during daemon startup.\n2. A **columnar scan** relies on columnar storage and can only be used on a columnar attribute. It scans every value and tests it against the filter, but it is heavily optimized and is typically faster than the default approach.\n3. **Secondary indexes** are generated for all attributes (except JSON) by default. They use the [PGM index](https://pgm.di.unipi.it/) along with Manticore's built-in inverted index to retrieve the list of row IDs corresponding to a value or range of values. Secondary indexes are stored in files with the `.spidx` and `.spjidx` extensions.\nFor information on how to generate secondary indexes over JSON attributes, see [json_secondary_indexes](../Creating_a_table/Local_tables/Plain_and_real-time_table_settings.md#json_secondary_indexes).\n\nThe optimizer estimates the cost of each execution path using various attribute statistics, including:\n\n1. Information on the data distribution within an attribute (histograms, stored in `.sphi` files). Histograms are generated automatically when data is indexed and serve as the primary source of information for the CBO.\n2. Information from PGM (secondary indexes), which helps estimate the number of document lists to read. This assists in gauging doclist merge performance and in selecting the appropriate merge algorithm (priority queue merge or bitmap merge).\n3. Columnar encoding statistics, employed to estimate columnar data decompression performance.\n4. A columnar min-max tree. While the CBO uses histograms to estimate the number of documents left after applying the filter, it also needs to determine how many documents the filter had to process. For columnar attributes, partial evaluation of the min-max tree serves this purpose.\n5. Full-text dictionary. The CBO utilizes term stats to estimate the cost of evaluating the full-text tree.\n\nThe optimizer computes the execution cost for every filter used in a query. Since certain filters can be replaced with several different entities (e.g., for a document id, Manticore can use a plain scan, a docid index lookup, a columnar scan (if the document id is columnar), and a secondary index), the optimizer evaluates all available combinations. However, there is a maximum limit of 1024 combinations.\n\nTo estimate query execution costs, the optimizer calculates the estimated costs of the most significant operations performed when executing the query. It uses preset constants to represent the cost of each operation.\n\nThe optimizer compares the costs of each execution path and chooses the path with the lowest cost to execute the query.\n\nWhen working with full-text queries that have filters by attributes, the query optimizer decides between two possible execution paths. One is to execute the full-text query, retrieve the matches, and use filters. The other is to replace filters with one or more entities described above, fetch rowids from them, and inject them into the full-text matching tree. This way, full-text search results will intersect with full-scan results. The query optimizer estimates the cost of full-text tree evaluation and the best possible path for computing filter results. Using this information, the optimizer chooses the execution path.\n\nAnother factor to consider is multithreaded query execution (when `pseudo_sharding` is enabled). The CBO is aware that some queries can be executed in multiple threads and takes this into account. The CBO prioritizes shorter query execution times (i.e., latency) over throughput. For instance, if a query using a columnar scan can be executed in multiple threads (and occupy multiple CPU cores) and is faster than a query executed in a single thread using secondary indexes, multithreaded execution will be preferred.\n\nQueries using secondary indexes and docid indexes always run in a single thread, as benchmarks indicate that there is little to no benefit in making them multithreaded.\n\nAt present, the optimizer only uses CPU costs and does not take memory or disk usage into account.\n\n<!-- proofread -->\n\n",
  14. "updated_at": 1768530797,
  15. "source_md5": "2c6ff62395264941264a78b2d0b946a9"
  16. }
  17. }