# Manticore Search 3.3.0：多线程RT、CREATE TABLE、EXPLAIN QUERY等

我们很高兴地宣布Manticore Search 3.3.0版本的发布。下载地址请访问[此处](https://manticoresearch.com/downloads/)。Docker镜像可在[Docker Hub](https://hub.docker.com/r/manticoresearch/manticore)获取。

# 新功能

### 多线程RT


3.3.0版本中的两个主要功能之一是**对实时索引的多线程搜索**。在实时索引包含多个磁盘块的情况下（这通常发生在你很少运行[OPTIMIZE](https://docs.manticoresearch.com/latest/html/sphinxql_reference/optimize_index_syntax.html#optimize-index-syntax)时），使用[dist_threads](https://docs.manticoresearch.com/latest/html/conf_options_reference/searchd_program_configuration_options.html#dist-threads) > 1将启用多线程并行搜索磁盘块。此前每个RT索引仅使用单一线程，如果它有多个磁盘块，所有块都会逐个搜索，导致搜索速度变慢（或非常慢）。如果你的应用程序不是CPU密集型的，新功能可以显著提升性能。性能甚至可能比执行OPTIMIZE后更高。


### CREATE TABLE<sup>α</sup> 和 DROP TABLE<sup>α</sup>

自3.3.0版本起，另一个主要功能是**支持CREATE和DROP TABLE**。从现在起，如果你使用实时索引（我们强烈推荐），你可能根本不需要为它们配置任何内容。你的配置现在可以如下所示：

```ini
searchd {
  listen = 9306:mysql41
  data_dir = data
  pid_file = 9306.pid
  binlog_path = data
}
```

就这样。之后只需执行以下操作创建索引：

```ini
mysql> create table idx(f field, a int);
Query OK, 0 rows affected (0.00 sec)
```

你的索引就会存在：

```sql
mysql> desc idx;
+-------+--------+----------------+
| Field | Type | Properties       |
+-------+--------+----------------+
| id    | bigint |                |
| f     | field  | indexed stored |
| a     | uint   |                |
+-------+--------+----------------+
3 rows in set (0.00 sec)

```

当不需要时，只需删除它：

```sql
mysql> drop table idx;
Query OK, 0 rows affected (0.00 sec)

mysql> show tables;
Empty set (0.00 sec)
```

这意味着现在从你的应用程序中，不仅可以轻松控制数据，还可以控制模式。这不是很棒吗？
**注意：此功能处于alpha阶段。尚未文档化，语法可能会有细微变化，我们不知道有人在生产环境中使用它。如果你想成为beta测试者，请告诉我们，我们将共同努力确保其正常工作。**

要使用此功能，配置中不能有任何索引/源定义，且data_dir需要按以下示例设置。此模式不支持普通索引。

现有设置仍按以前方式工作，但你不能在其中使用CREATE/DROP TABLE命令。


### `indexer --print-rt`


[Indexer](https://docs.manticoresearch.com/latest/html/command_line_tools_reference/indexer_command_reference.html)现在有一个新选项--print-rt，它将普通索引源的数据转储为实时索引的INSERT命令。同时，数据的模式作为实时字段/属性提供。


### EXPLAIN QUERY


[EXPLAIN QUERY](https://docs.manticoresearch.com/latest/html/sphinxql_reference/explain_query_syntax.html)是一个返回全文查询执行树的命令，类似于[SHOW PLAN](https://docs.manticoresearch.com/latest/html/sphinxql_reference/show_plan_syntax.html)，但不同之处在于它不会实际在索引上执行搜索，索引可以是空的，甚至是模板类型。以下是一个示例：

```sql
mysql> explain query idx 'abc "def ghi" "a b c d"~5 I'\G
*************************** 1. row ***************************
Variable: transformed_tree
Value: AND(
AND(KEYWORD(abc, querypos=1)),
PHRASE(
AND(KEYWORD(def, querypos=2)),
AND(KEYWORD(ghi, querypos=3))),
PROXIMITY(distance=5,
AND(KEYWORD(b, querypos=4)),
AND(KEYWORD(c, querypos=5)),
AND(KEYWORD(d, querypos=6))))
1 row in set (0.00 sec)
```

### 其他改进

- 更新到[Snowball 2.0](https://snowballstem.org/)词干库。这将词干数量增加到[25](https://docs.manticoresearch.com/latest/html/conf_options_reference/index_configuration_options.html#morphology)，所有词干都包含在我们的[软件包](https://manticoresearch.com/downloads/)中
- [SHOW INDEX STATUS](https://docs.manticoresearch.com/latest/html/sphinxql_reference/show_index_status_syntax.html)语句增加了LIKE以方便过滤
- 对于分布式索引上具有高[max_matches](https://docs.manticoresearch.com/latest/html/sphinxql_reference/select_syntax.html#option)的查询，内存使用已大幅改善
- 对于systemd软件包，我们已将LimitNOFILE从'infinity'更改为65536
- [Percolate Queries](https://docs.manticoresearch.com/latest/html/searching/percolate_query.html)现在无锁 - 在之前的版本中，长时间的CALL PQ或更新存储查询会相互干扰


此版本修复了许多错误，其中一些包括：

- `HIGHLIGHT()`与passage宏的问题 ([493a5e9](https://github.com/manticoresoftware/manticoresearch/commit/493a5e916d70fd4a3f14d1ee487234434f4a7ce3)) 和html剥离 ([ca81114](https://github.com/manticoresoftware/manticoresearch/commit/ca81114bf1ac7ea7adcc8509bdc14d1f30b4f461))
- 在某些情况下，RT索引创建了过多的磁盘块 ([8bea0f6](https://github.com/manticoresoftware/manticoresearch/commit/8bea0f6fd1666b817995c4dd6e67f6f1c9161638), [a82d41c)](https://github.com/manticoresoftware/manticoresearch/commit/a82d41c775692f837f267d554d7d4a4b499d69f0)
- 与ATTACH一起使用时的docstore问题 ([6895374](https://github.com/manticoresoftware/manticoresearch/commit/68953740af8dca1833026d0f448c71416ed3044a)) 和分布式索引 ([d6f696e](https://github.com/manticoresoftware/manticoresearch/commit/d6f696edea53ea2b9a68251e4054e4816082c285>))





如需完整的变更日志，请参阅[发布说明](https://docs.manticoresearch.com/latest/html/releasenotes.html#version-3-3-0-4-february-2020)。
