Full Scan query in Mysql

Created on 16 January 2023, over 1 year ago
Updated 13 February 2024, 5 months ago

Problem/Motivation

When activate the module, the slowquery log of the mysql server growth very fast

Steps to reproduce

Have mysql server with slowquery logging activated
Enable module site settings on drupal installation
Mysql starts logging :

# Time: 2023-01-16T07:27:24.821775Z
# User@Host: Id: 372123
# Schema: Last_errno: 0 Killed: 0
# Query_time: 0.000210 Lock_time: 0.000069 Rows_sent: 1 Rows_examined: 1 Rows_affected: 0 Bytes_sent: 327
# Tmp_tables: 0 Tmp_disk_tables: 0 Tmp_table_sizes: 0
# Profile_starting: 0.000031 Profile_starting_cpu: 0.000031 Profile_checking_permissions: 0.000009 Profile_checking_permissions_cpu: 0.000009 Profile_Opening_tables: 0.000015 Profile_Opening_tables_cpu: 0.000014 Profile_init: 0.000013 Profile_init_cpu: 0.000013 Profile_System_lock: 0.000012 Profile_System_lock_cpu: 0.000012 Profile_optimizing: 0.000008 Profile_optimizing_cpu: 0.000008 Profile_statistics: 0.000010 Profile_statistics_cpu: 0.000011 Profile_preparing: 0.000010 Profile_preparing_cpu: 0.000010 Profile_executing: 0.000008 Profile_executing_cpu: 0.000008 Profile_Sending_data: 0.000022 Profile_Sending_data_cpu: 0.000022 Profile_end: 0.000008 Profile_end_cpu: 0.000008 Profile_query_end: 0.000009 Profile_query_end_cpu: 0.000009 Profile_closing_tables: 0.000012 Profile_closing_tables_cpu: 0.000012 Profile_freeing_items: 0.000035 Profile_freeing_items_cpu: 0.000035 Profile_logging_slow_query: 0.000008 Profile_logging_slow_query_cpu: 0.000008
# Profile_total: 0.000209 Profile_total_cpu: 0.000209
# InnoDB_trx_id: 0
# QC_Hit: No Full_scan: Yes Full_join: No Tmp_table: No Tmp_table_on_disk: No
# Filesort: No Filesort_on_disk: No Merge_passes: 0
# InnoDB_IO_r_ops: 0 InnoDB_IO_r_bytes: 0 InnoDB_IO_r_wait: 0.000000
# InnoDB_rec_lock_wait: 0.000000 InnoDB_queue_wait: 0.000000
# InnoDB_pages_distinct: 1
SET timestamp=1673854044;
SELECT "base"."id" AS "id", "base"."type" AS "type", "base"."uuid" AS "uuid", "base"."langcode" AS "langcode"
FROM
"site_setting_entity" "base";

Proposed resolution

Add a where clause to the query to avoid full scan

πŸ› Bug report
Status

Closed: cannot reproduce

Version

1.20

Component

Code

Created by

πŸ‡«πŸ‡·France rack42

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • Status changed to Postponed: needs info 10 months ago
  • πŸ‡¬πŸ‡§United Kingdom scott_euser

    How many items do you have in `site_setting_entity` table? Seems like it should be a very standard Drupal Entity Query, and the number of items Entities would be expected to be lower than eg Nodes or Taxonomy Terms.

  • Status changed to Closed: cannot reproduce 5 months ago
  • πŸ‡¬πŸ‡§United Kingdom scott_euser
Production build 0.69.0 2024