Solr加入解析器性能问题

时间:2017-05-15 11:14:39

标签: parsing join solr solrcloud

Solr Version: 6.3.0
Cloud: Yes
Shards: Single(1)
Data Size: 50GB
Records: 12M

我们有一个Solr Join查询,它试图从给定集合中找到相关的ID(是自连接)。这会导致性能下降。

分析发现,Solr正在扫描from_field中的所有项,而不考虑所提到的q滤波器,然后尝试与to_field项相交。有没有办法让我们可以让solr在与Join解析器中的to_field相交之前过滤这些术语?

对于给定的solr字段,我们有大约9M的术语,我们认为这是导致性能下降的原因。

"join": {

    "{!join from=from_field to=to_field fromIndex=insight_pats_1_shard1_replica1}to_field: \u0001\u0000\u0000\u0000\u0000\u0000\u0003X\u0002H": {
        "time": 16824,
        "fromSetSize": 1,
        "toSetSize": 0,
        "fromTermCount": 8561723,
        "fromTermTotalDf": 8561723,
        "fromTermDirectCount": 8561505,
        "fromTermHits": 0,
        "fromTermHitsTotalDf": 0,
        "toTermHits": 0,
        "toTermHitsTotalDf": 0,
        "toTermDirectCount": 0,
        "smallSetsDeferred": 0,
        "toSetDocsAdded": 0
    }

},
"rawquerystring": "*:*",
"querystring": "*:*",
"parsedquery": "(+MatchAllDocsQuery(*:*))/no_coord",
"parsedquery_toString": "+*:*",
"explain": { },
"QParser": "ExtendedDismaxQParser",
"altquerystring": null,
"boost_queries": null,
"parsed_boost_queries": [ ],
"boostfuncs": null,
"filter_queries": [

    "account_ids:1",
    "{!join from=from_field to=to_field fromIndex=insight_pats_1}to_field:7733576"

],
"parsed_filter_queries": [

    "account_ids:1",
    "JoinQuery({!join from=from_field to=to_field fromIndex=insight_pats_1_shard1_replica1}to_field: \u0001\u0000\u0000\u0000\u0000\u0000\u0003X\u0002H)"

]

1 个答案:

答案 0 :(得分:0)

有两种类型的连接解析器

  • JoinQueryParser
  • ScoreJoinQParser

默认情况下!join使用JoinQueryParser,但不适合加入大小为百万的记录。

我们可以通过在!join parser命令中添加参数score = none来要求SOLR使用ScoreJoinQParser,如下所示。

http://localhost:8983/solr/mycollection/select?fq={!join from=from_field to=to_field fromIndex=from_collection score=none}&indent=on&q=*:*&wt=json&debugQuery=on

当from_field术语在800万

范围内时,我们能够实现30倍的性能提升