Kipcool has submitted this change and it was merged.

Change subject: Specialdatasearch query speed
......................................................................


Specialdatasearch query speed

the problem was not counting the number of results,
but was linked to when a collection is added.
A straight-join performs faster.

Change-Id: If0868249fa7877fcce5c7354b4e749cc7f060770
---
M includes/specials/SpecialDatasearch.php
1 file changed, 8 insertions(+), 4 deletions(-)

Approvals:
  Kipcool: Verified; Looks good to me, approved



diff --git a/includes/specials/SpecialDatasearch.php 
b/includes/specials/SpecialDatasearch.php
index c8ccf12..17d3869 100644
--- a/includes/specials/SpecialDatasearch.php
+++ b/includes/specials/SpecialDatasearch.php
@@ -235,7 +235,6 @@
                $whereClause = array(
                        'exp.expression_id = synt.expression_id',
                        'synt.identical_meaning' => 1,
-                       'exp.remove_transaction_id' => null,
                        'synt.remove_transaction_id' => null
                );
 
@@ -244,6 +243,8 @@
                        'ORDER BY' => 'exp.spelling ASC',
                        'LIMIT' => $this->limit
                );
+
+               $join = array();
 
                if ( $this->offset > 0 ) {
                        $options['OFFSET'] = $this->offset;
@@ -271,9 +272,12 @@
                if ( $this->collectionId > 0 ) {
                        $tables['colcont'] = "{$dc}_collection_contents";
 
-                       $whereClause[] = 'colcont.member_mid = 
synt.defined_meaning_id';
-                       $whereClause['colcont.collection_id'] = 
$this->collectionId;
-                       $whereClause['colcont.remove_transaction_id'] = null;
+                       // without straight join, the query takes too long
+                       $join['colcont'] = array( 'STRAIGHT_JOIN', array(
+                               'colcont.member_mid = synt.defined_meaning_id',
+                               'colcont.collection_id' => $this->collectionId,
+                               'colcont.remove_transaction_id' => null
+                       ));
                }
 
                // The query for the search itself! Uses limit and offset

-- 
To view, visit https://gerrit.wikimedia.org/r/71849
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: If0868249fa7877fcce5c7354b4e749cc7f060770
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WikiLexicalData
Gerrit-Branch: master
Gerrit-Owner: Kipcool <[email protected]>
Gerrit-Reviewer: Kipcool <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to