• Resolved 762mm

    (@762mm)


    Although search results come back very quickly for me, I am getting frequent slow queries logged for MySQL.

    They are of the forms:

    # Query_time: 36.919798 Lock_time: 0.000053 Rows_sent: 1 Rows_examined: 7586413
    # Rows_affected: 0 Bytes_sent: 90
    SET timestamp=1669144788;
    SELECT COUNT(DISTINCT(relevanssi.doc)) FROM wp_relevanssi AS relevanssi
    WHERE relevanssi.term = relevanssi.term;`

    # Query_time: 749.798435 Lock_time: 0.000069 Rows_sent: 500 Rows_examined: 7616740
    # Rows_affected: 0 Bytes_sent: 25728
    SET timestamp=1669144804;
    SELECT DISTINCT(relevanssi.doc), 1 AS term, 1 AS term_reverse,
    1 AS content, 1 AS title, 1 AS comment, 1 AS tag, 1 AS link, 1 AS
    author, 1 AS category, 1 AS excerpt, 1 AS taxonomy, 1 AS customfield,
    1 AS mysqlcolumn, 1 AS taxonomy_detail, 1 AS customfield_detail, 1 AS
    mysqlcolumn_detail, type, item, 1 AS tf
    FROM wp_relevanssi AS relevanssi
    WHERE relevanssi.term = relevanssi.term GROUP BY doc, item, type ORDER BY doc ASC LIMIT 500;`

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Mikko Saari

    (@msaari)

    Those are searches without search terms. You can stop these with this code snippet:

    add_filter( 'relevanssi_search_ok', function( $ok, $query ) {
      return empty( $query->query_vars['s'] ) ? false : $ok;
    }, 10, 2 );

    Once you add this to your site, Relevanssi won’t do searches without a search term anymore.

    Thread Starter 762mm

    (@762mm)

    Thanks! That worked.

    It may seem like searches without search terms would be rare, but for some reason googlebot is crawling malformed urls that are causing thousands of these each hour on my site.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘MySQL Slow Queries’ is closed to new replies.