2

We are currently experiencing an intermittent issue with UPDATE/DELETE/INSERT performance.

Simple queries like the following take a long time:

DELETE FROM ip_filter WHERE filter_id = '348';

Queries like these sometimes take 2 seconds or even longer.

An index is established on the filter_id field, and an explain yields the following results:

id, select_type, table, type, possible_keys, key, key_len, ref, rows, Extra

'1', 'SIMPLE', 'ip_filter', 'ref', 'ip_and_filter_id', 'ip_and_filter_id', '4', 'const', '8', 'Using index'

One of the problems is that these issues happen sporadically, and generally after one of these slow queries happens, the next similar query will be fast.

A thing of note is that these tables will get a lot of SELECT activity, as they are queried often, even though the tables themself are pretty small.

We have experimented with reducing our query cache size from 512MB to 256MB to see if this would alleviate the problem. It currently seems that the issue is not as prevalent anymore as it previously was, but it still does occur.

Are there any other steps we could take to debug this issue?

EDIT as requested, the table structure:

CREATE TABLE `ip_filter` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `filter_id` int(10) unsigned NOT NULL,
  `ip_from` int(10) unsigned zerofill DEFAULT NULL,
  `ip_to` int(10) unsigned zerofill DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `ip_and_filter_id` (`filter_id`,`ip_from`,`ip_to`),
  KEY `ip_range` (`ip_from`,`ip_to`,`filter_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8

EDIT2: as requested, SHOW GLOBAL STATUS and SHOW GLOBAL VARIABLES (apologies for any possible formatting errors, and in addition some entries were omitted to stay in the character limit for this post):

mysql> SHOW GLOBAL STATUS;
+-----------------------------------------------+--------------------------------------------------+
| Variable_name   | Value    |
+-----------------------------------------------+--------------------------------------------------+
| Aborted_clients | 1002|
| Aborted_connects| 13620    |
| Binlog_cache_disk_use| 18304    |
| Binlog_cache_use| 50907641 |
| Binlog_stmt_cache_disk_use| 21583    |
| Binlog_stmt_cache_use| 693818   |
| Bytes_received  | 373853485296  |
| Bytes_sent | 2307802779423 |
| Compression| OFF |
| Connections| 560733528|
| Created_tmp_disk_tables   | 479926   |
| Created_tmp_files    | 244099   |
| Created_tmp_tables   | 4792534  |
| Delayed_errors  | 64869    |
| Delayed_insert_threads    | 1   |
| Delayed_writes  | 79287    |
| Flush_commands  | 1   |
| Handler_commit  | 405017753|
| Handler_delete  | 960022   |
| Handler_discover| 0   |
| Handler_external_lock| 2007319506    |
| Handler_mrr_init| 0   |
| Handler_prepare | 100974274|
| Handler_read_first   | 10746649 |
| Handler_read_key| 18232267091   |
| Handler_read_last    | 19  |
| Handler_read_next    | 56428606901   |
| Handler_read_prev    | 245978   |
| Handler_read_rnd| 4498710625    |
| Handler_read_rnd_next| 45742264916   |
| Handler_rollback| 6178|
| Handler_savepoint    | 0   |
| Handler_savepoint_rollback| 0   |
| Handler_update  | 8254153588    |
| Handler_write   | 11890926042   |
| Innodb_buffer_pool_dump_status | not started   |
| Innodb_buffer_pool_load_status | Buffer pool(s) load completed at 141128  8:04:25 |
| Innodb_background_log_sync| 3798209  |
| Innodb_buffer_pool_pages_data  | 483817   |
| Innodb_buffer_pool_bytes_data  | 7926857728    |
| Innodb_buffer_pool_pages_dirty | 699 |
| Innodb_buffer_pool_bytes_dirty | 11452416 |
| Innodb_buffer_pool_pages_flushed    | 192945519|
| Innodb_buffer_pool_pages_LRU_flushed| 0   |
| Innodb_buffer_pool_pages_free  | 8192|
| Innodb_buffer_pool_pages_made_not_young  | 1838366113    |
| Innodb_buffer_pool_pages_made_young | 10981231 |
| Innodb_buffer_pool_pages_misc  | 32271    |
| Innodb_buffer_pool_pages_old   | 178434   |
| Innodb_buffer_pool_pages_total | 524280   |
| Innodb_buffer_pool_read_ahead_rnd   | 0   |
| Innodb_buffer_pool_read_ahead  | 3381468  |
| Innodb_buffer_pool_read_ahead_evicted    | 0   |
| Innodb_buffer_pool_read_requests    | 240688389755  |
| Innodb_buffer_pool_reads  | 49368230 |
| Innodb_buffer_pool_wait_free   | 0   |
| Innodb_buffer_pool_write_requests   | 24744355863   |
| Innodb_checkpoint_age| 3081858  |
| Innodb_checkpoint_max_age | 80826164 |
| Innodb_data_fsyncs   | 74420033 |
| Innodb_data_pending_fsyncs| 0   |
| Innodb_data_pending_reads | 0   |
| Innodb_data_pending_writes| 0   |
| Innodb_data_read| 880507834368  |
| Innodb_data_reads    | 50348628 |
| Innodb_data_writes   | 116817456|
| Innodb_data_written  | 8742201090048 |
| Innodb_dblwr_pages_written| 192945519|
| Innodb_dblwr_writes  | 5548104  |
| Innodb_deadlocks| 0   |
| Innodb_have_atomic_builtins    | ON  |
| Innodb_history_list_length| 2465|
| Innodb_ibuf_discarded_delete_marks  | 0   |
| Innodb_ibuf_discarded_deletes  | 0   |
| Innodb_ibuf_discarded_inserts  | 0   |
| Innodb_ibuf_free_list| 2216|
| Innodb_ibuf_merged_delete_marks| 112003   |
| Innodb_ibuf_merged_deletes| 74608    |
| Innodb_ibuf_merged_inserts| 4805145  |
| Innodb_ibuf_merges   | 1033719  |
| Innodb_ibuf_segment_size  | 2218|
| Innodb_ibuf_size| 1   |
| Innodb_log_waits| 4812|
| Innodb_log_write_requests | 5014978044    |
| Innodb_log_writes    | 56207419 |
| Innodb_lsn_current   | 21913335542724|
| Innodb_lsn_flushed   | 21913335542724|
| Innodb_lsn_last_checkpoint| 21913332460866|
| Innodb_master_thread_active_loops   | 3798046  |
| Innodb_master_thread_idle_loops| 163 |
| Innodb_max_trx_id    | 3124981165    |
| Innodb_mem_adaptive_hash  | 680116592|
| Innodb_mem_dictionary| 41727522 |
| Innodb_mem_total| 8791261184    |
| Innodb_mutex_os_waits| 9260778  |
| Innodb_mutex_spin_rounds  | 459072900|
| Innodb_mutex_spin_waits   | 230355306|
| Innodb_oldest_view_low_limit_trx_id | 0   |
| Innodb_os_log_fsyncs | 56456392 |
| Innodb_os_log_pending_fsyncs   | 0   |
| Innodb_os_log_pending_writes   | 0   |
| Innodb_os_log_written| 2419507923968 |
| Innodb_page_size| 16384    |
| Innodb_pages_created | 32015116 |
| Innodb_pages_read    | 53741803 |
| Innodb_pages_written | 192945519|
| Innodb_purge_trx_id  | 3124980536    |
| Innodb_purge_undo_no | 0   |
| Innodb_row_lock_current_waits  | 0   |
| Innodb_current_row_locks  | 0   |
| Innodb_row_lock_time | 555071   |
| Innodb_row_lock_time_avg  | 113 |
| Innodb_row_lock_time_max  | 10579    |
| Innodb_row_lock_waits| 4881|
| Innodb_rows_deleted  | 960706   |
| Innodb_rows_inserted | 1781038652    |
| Innodb_rows_read| 106500471157  |
| Innodb_rows_updated  | 4216691817    |
| Innodb_num_open_files| 276 |
| Innodb_read_views_memory  | 608 |
| Innodb_descriptors_memory | 8000|
| Innodb_s_lock_os_waits    | 1518546  |
| Innodb_s_lock_spin_rounds | 88671245 |
| Innodb_s_lock_spin_waits  | 32303938 |
| Innodb_truncated_status_writes | 0   |
| Innodb_available_undo_logs| 128 |
| Innodb_x_lock_os_waits    | 3751147  |
| Innodb_x_lock_spin_rounds | 274895733|
| Innodb_x_lock_spin_waits  | 12452149 |
| Key_blocks_not_flushed    | 0   |
| Key_blocks_unused    | 639319   |
| Key_blocks_used | 730098   |
| Key_read_requests    | 98022049796   |
| Key_reads  | 597390   |
| Key_write_requests   | 4123062130    |
| Key_writes | 2076944  |
| Last_query_cost | 0.000000 |
| Last_query_partial_plans  | 0   |
| Max_statement_time_exceeded    | 0   |
| Max_statement_time_set    | 0   |
| Max_statement_time_set_failed  | 0   |
| Max_used_connections | 486 |
| Not_flushed_delayed_rows  | 0   |
| Open_files | 307 |
| Open_streams    | 0   |
| Open_table_definitions    | 244 |
| Open_tables| 1966|
| Opened_files    | 2315351  |
| Opened_table_definitions  | 15832    |
| Opened_tables   | 21898    |
| Qcache_free_blocks   | 27443    |
| Qcache_free_memory   | 44816704 |
| Qcache_hits| 244230270|
| Qcache_inserts  | 388578154|
| Qcache_lowmem_prunes | 264072283|
| Qcache_not_cached    | 9221053  |
| Qcache_queries_in_cache   | 119845   |
| Qcache_total_blocks  | 268253   |
| Queries    | 7122289356    |
| Questions  | 1818979018    |
| Select_full_join| 74006    |
| Select_full_range_join    | 603 |
| Select_range    | 134013323|
| Select_range_check   | 44  |
| Select_scan| 2861498  |
| Slave_heartbeat_period    | 0.000    |
| Slave_last_heartbeat ||
| Slave_open_temp_tables    | 0   |
| Slave_received_heartbeats | 0   |
| Slave_retried_transactions| 0   |
| Slave_running   | OFF |
| Slow_launch_threads  | 0   |
| Slow_queries    | 1510|
| Sort_merge_passes    | 255576   |
| Sort_range | 999591   |
| Sort_rows  | 2156328903    |
| Sort_scan  | 4467016  |
| Table_locks_immediate| 999835187|
| Table_locks_waited   | 3484|
| Table_open_cache_hits| 936160886|
| Table_open_cache_misses   | 6442|
| Table_open_cache_overflows| 461 |
| Tc_log_max_pages_used| 0   |
| Tc_log_page_size| 0   |
| Tc_log_page_waits    | 0   |
| Threadpool_idle_threads   | 0   |
| Threadpool_threads   | 0   |
| Threads_cached  | 6   |
| Threads_connected    | 16  |
| Threads_created | 1430444  |
| Threads_running | 3   |

+-----------------------------------------------+--------------------------------------------------+
397 rows in set (0.00 sec)

mysql> SHOW GLOBAL VARIABLES;
+----------------------------------------------------------------------------------------------------------+
| Variable_name  | Value |
+--------------------------------------------------------+---------------------------------------+
| auto_increment_increment | 1|
| auto_increment_offset    | 1|
| autocommit| ON    |
| automatic_sp_privileges  | ON    |
| back_log  | 250   |
| basedir   | /usr/local |
| big_tables| OFF   |
| bind_address   | *|
| binlog_cache_size   | 32768 |
| binlog_checksum| CRC32 |
| binlog_direct_non_transactional_updates | OFF   |
| binlog_format  | MIXED |
| binlog_max_flush_queue_time   | 0|
| binlog_order_commits| ON    |
| binlog_row_image    | FULL  |
| binlog_rows_query_log_events  | OFF   |
| binlog_stmt_cache_size   | 32768 |
| bulk_insert_buffer_size  | 8388608    |
| completion_type| NO_CHAIN   |
| concurrent_insert   | AUTO  |
| connect_timeout| 10    |
| core_file | OFF   |
| datadir   | /home/mysql/    |
| date_format    | %Y-%m-%d   |
| datetime_format| %Y-%m-%d %H:%i:%s    |
| default_storage_engine   | InnoDB|
| default_tmp_storage_engine    | InnoDB|
| default_week_format | 0|
| delay_key_write| ON    |
| delayed_insert_limit| 100   |
| delayed_insert_timeout   | 300   |
| delayed_queue_size  | 1000  |
| disconnect_on_expired_password| ON    |
| div_precision_increment  | 4|
| end_markers_in_json | OFF   |
| enforce_gtid_consistency | OFF   |
| enforce_storage_engine   |  |
| eq_range_index_dive_limit| 10    |
| event_scheduler| OFF   |
| expand_fast_index_creation    | OFF   |
| expire_logs_days    | 2|
| explicit_defaults_for_timestamp    | OFF   |
| extra_max_connections    | 1|
| extra_port| 0|
| flush| OFF   |
| flush_time| 0|
| foreign_key_checks  | ON    |
| ft_boolean_syntax   | + -><()~*:""&|  |
| ft_max_word_len| 84    |
| ft_min_word_len| 4|
| ft_query_expansion_limit | 20    |
| ft_stopword_file    | (built-in) |
| general_log    | OFF   |
| general_log_file    | /home/mysql/sql01.log|
| group_concat_max_len| 1024  |
| gtid_executed  |  |
| gtid_mode | OFF   |
| gtid_owned|  |
| gtid_purged    |  |
| have_compress  | YES   |
| have_crypt| YES   |
| have_dynamic_loading| YES   |
| have_geometry  | YES   |
| have_openssl   | DISABLED   |
| have_profiling | YES   |
| have_query_cache    | YES   |
| have_rtree_keys| YES   |
| have_ssl  | DISABLED   |
| have_statement_timeout   | YES   |
| have_symlink   | YES   |
| host_cache_size| 653   |
| hostname  | sql01.<STRIPPED>.com  |
| ignore_builtin_innodb    | OFF   |
| ignore_db_dirs |  |
| init_connect   |  |
| init_file |  |
| init_slave|  |
| innodb_adaptive_flushing | ON    |
| innodb_adaptive_flushing_lwm  | 10    |
| innodb_adaptive_hash_index    | ON    |
| innodb_adaptive_hash_index_partitions   | 1|
| innodb_adaptive_max_sleep_delay    | 150000|
| innodb_additional_mem_pool_size    | 8388608    |
| innodb_api_bk_commit_interval | 5|
| innodb_api_disable_rowlock    | OFF   |
| innodb_api_enable_binlog | OFF   |
| innodb_api_enable_mdl    | OFF   |
| innodb_api_trx_level| 0|
| innodb_autoextend_increment   | 64    |
| innodb_autoinc_lock_mode | 1|
| innodb_buffer_pool_dump_at_shutdown| ON    |
| innodb_buffer_pool_dump_now   | OFF   |
| innodb_buffer_pool_filename   | ib_buffer_pool  |
| innodb_buffer_pool_instances  | 8|
| innodb_buffer_pool_load_abort | OFF   |
| innodb_buffer_pool_load_at_startup | ON    |
| innodb_buffer_pool_load_now   | OFF   |
| innodb_buffer_pool_populate   | OFF   |
| innodb_buffer_pool_size  | 8589934592 |
| innodb_change_buffer_max_size | 25    |
| innodb_change_buffering  | all   |
| innodb_checksum_algorithm| innodb|
| innodb_checksums    | ON    |
| innodb_cleaner_lsn_age_factor | high_checkpoint |
| innodb_cmp_per_index_enabled  | OFF   |
| innodb_commit_concurrency| 0|
| innodb_compression_failure_threshold_pct| 5|
| innodb_compression_level | 6|
| innodb_compression_pad_pct_max| 50    |
| innodb_concurrency_tickets    | 5000  |
| innodb_corrupt_table_action   | assert|
| innodb_data_file_path    | ibdata1:12M:autoextend    |
| innodb_data_home_dir| /home/mysql/    |
| innodb_disable_sort_file_cache| OFF   |
| innodb_doublewrite  | ON    |
| innodb_empty_free_list_algorithm   | backoff    |
| innodb_fake_changes | OFF   |
| innodb_fast_shutdown| 1|
| innodb_file_format  | Antelope   |
| innodb_file_format_check | ON    |
| innodb_file_format_max   | Antelope   |
| innodb_file_per_table    | ON    |
| innodb_flush_log_at_timeout   | 1|
| innodb_flush_log_at_trx_commit| 1|
| innodb_flush_method |  |
| innodb_flush_neighbors   | 1|
| innodb_flushing_avg_loops| 30    |
| innodb_force_load_corrupted   | OFF   |
| innodb_force_recovery    | 0|
| innodb_foreground_preflush    | exponential_backoff  |
| innodb_ft_aux_table |  |
| innodb_ft_cache_size| 8000000    |
| innodb_ft_enable_diag_print   | OFF   |
| innodb_ft_enable_stopword| ON    |
| innodb_ft_max_token_size | 84    |
| innodb_ft_min_token_size | 3|
| innodb_ft_num_word_optimize   | 2000  |
| innodb_ft_result_cache_limit  | 2000000000 |
| innodb_ft_server_stopword_table    |  |
| innodb_ft_sort_pll_degree| 2|
| innodb_ft_total_cache_size    | 640000000  |
| innodb_ft_user_stopword_table |  |
| innodb_io_capacity  | 200   |
| innodb_io_capacity_max   | 2000  |
| innodb_kill_idle_transaction  | 0|
| innodb_large_prefix | OFF   |
| innodb_lock_wait_timeout | 50    |
| innodb_locking_fake_changes   | ON    |
| innodb_locks_unsafe_for_binlog| OFF   |
| innodb_log_arch_dir | /home/mysql/    |
| innodb_log_arch_expire_sec    | 0|
| innodb_log_archive  | OFF   |
| innodb_log_block_size    | 512   |
| innodb_log_buffer_size   | 8388608    |
| innodb_log_checksum_algorithm | innodb|
| innodb_log_compressed_pages   | ON    |
| innodb_log_file_size| 50331648   |
| innodb_log_files_in_group| 2|
| innodb_log_group_home_dir| /home/mysql/    |
| innodb_lru_scan_depth    | 1024  |
| innodb_max_bitmap_file_size   | 104857600  |
| innodb_max_changed_pages | 1000000    |
| innodb_max_dirty_pages_pct    | 75    |
| innodb_max_dirty_pages_pct_lwm| 0|
| innodb_max_purge_lag| 0|
| innodb_max_purge_lag_delay    | 0|
| innodb_mirrored_log_groups    | 1|
| innodb_monitor_disable   |  |
| innodb_monitor_enable    |  |
| innodb_monitor_reset|  |
| innodb_monitor_reset_all |  |
| innodb_old_blocks_pct    | 37    |
| innodb_old_blocks_time   | 1000  |
| innodb_online_alter_log_max_size   | 134217728  |
| innodb_open_files   | 2048  |
| innodb_optimize_fulltext_only | OFF   |
| innodb_page_size    | 16384 |
| innodb_print_all_deadlocks    | OFF   |
| innodb_purge_batch_size  | 300   |
| innodb_purge_threads| 1|
| innodb_random_read_ahead | OFF   |
| innodb_read_ahead_threshold   | 56    |
| innodb_read_io_threads   | 4|
| innodb_read_only    | OFF   |
| innodb_replication_delay | 0|
| innodb_rollback_on_timeout    | OFF   |
| innodb_rollback_segments | 128   |
| innodb_show_locks_held   | 10    |
| innodb_show_verbose_locks| 0|
| innodb_sort_buffer_size  | 1048576    |
| innodb_spin_wait_delay   | 6|
| innodb_stats_auto_recalc | ON    |
| innodb_stats_method | nulls_equal|
| innodb_stats_on_metadata | OFF   |
| innodb_stats_persistent  | ON    |
| innodb_stats_persistent_sample_pages    | 20    |
| innodb_stats_sample_pages| 8|
| innodb_stats_transient_sample_pages| 8|
| innodb_strict_mode  | ON    |
| innodb_support_xa   | ON    |
| innodb_sync_array_size   | 1|
| innodb_sync_spin_loops   | 30    |
| innodb_table_locks  | ON    |
| innodb_thread_concurrency| 0|
| innodb_thread_sleep_delay| 10000 |
| innodb_track_changed_pages    | OFF   |
| innodb_undo_directory    | .|
| innodb_undo_logs    | 128   |
| innodb_undo_tablespaces  | 0|
| innodb_use_atomic_writes | OFF   |
| innodb_use_global_flush_log_at_trx_commit    | ON    |
| innodb_use_native_aio    | OFF   |
| innodb_use_sys_malloc    | ON    |
| innodb_version | 5.6.15-63.0|
| innodb_write_io_threads  | 4|
| interactive_timeout | 14400 |
| join_buffer_size    | 262144|
| keep_files_on_create| OFF   |
| key_buffer_size| 1073741824 |
| key_cache_age_threshold  | 300   |
| key_cache_block_size| 1024  |
| key_cache_division_limit | 100   |
| large_files_support | ON    |
| large_page_size| 0|
| large_pages    | OFF   |
| lc_messages    | en_US |
| lc_messages_dir| /usr/local/share/mysql/   |
| lc_time_names  | en_US |
| license   | GPL   |
| local_infile   | ON    |
| lock_wait_timeout   | 31536000   |
| locked_in_memory    | OFF   |
| log_bin   | ON    |
| log_bin_basename    | /home/mysql/mysql-bin|
| log_bin_index  | /home/mysql/mysql-bin.index    |
| log_bin_trust_function_creators    | OFF   |
| log_bin_use_v1_row_events| OFF   |
| log_error | /home/mysql/mysql-error.log    |
| log_output| FILE  |
| log_queries_not_using_indexes | OFF   |
| log_slave_updates   | ON    |
| log_slow_admin_statements| OFF   |
| log_slow_filter|  |
| log_slow_rate_limit | 1|
| log_slow_rate_type  | session    |
| log_slow_slave_statements| OFF   |
| log_slow_sp_statements   | ON    |
| log_slow_verbosity  |  |
| log_throttle_queries_not_using_indexes  | 0|
| log_warnings   | 1|
| log_warnings_suppress    |  |
| long_query_time| 10.000000  |
| low_priority_updates| OFF   |
| lower_case_file_system   | OFF   |
| lower_case_table_names   | 0|
| master_info_repository   | FILE  |
| master_verify_checksum   | OFF   |
| max_allowed_packet  | 16777216   |
| max_binlog_cache_size    | 18446744073709547520 |
| max_binlog_files    | 0|
| max_binlog_size| 1073741824 |
| max_binlog_stmt_cache_size    | 18446744073709547520 |
| max_connect_errors  | 1000  |
| max_connections| 1000  |
| max_delayed_threads | 20    |
| max_error_count| 64    |
| max_heap_table_size | 33554432   |
| max_insert_delayed_threads    | 20    |
| max_join_size  | 18446744073709551615 |
| max_length_for_sort_data | 1024  |
| max_prepared_stmt_count  | 16382 |
| max_relay_log_size  | 0|
| max_seeks_for_key   | 18446744073709551615 |
| max_sort_length| 1024  |
| max_sp_recursion_depth   | 0|
| max_statement_time  | 0|
| max_tmp_tables | 32    |
| max_user_connections| 0|
| max_write_lock_count| 18446744073709551615 |
| metadata_locks_cache_size| 1024  |
| metadata_locks_hash_instances | 8|
| min_examined_row_limit   | 0|
| multi_range_count   | 256   |
| myisam_data_pointer_size | 6|
| myisam_max_sort_file_size| 9223372036853727232  |
| myisam_mmap_size    | 18446744073709551615 |
| myisam_recover_options   | BACKUP,FORCE    |
| myisam_repair_threads    | 1|
| myisam_sort_buffer_size  | 67108864   |
| myisam_stats_method | nulls_unequal   |
| myisam_use_mmap| OFF   |
| net_buffer_length   | 16384 |
| net_read_timeout    | 30    |
| net_retry_count| 10    |
| net_write_timeout   | 60    |
| new  | OFF   |
| old  | OFF   |
| old_alter_table| OFF   |
| old_passwords  | 0|
| open_files_limit    | 22190 |
| optimizer_prune_level    | 1|
| optimizer_search_depth   | 62    |
| optimizer_switch    | index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=on,index_condition_pushdown=on,mrr=on,mrr_cost_based=on,block_nested_loop=on,batched_key_access=off,materialization=on,semijoin=on,loosescan=on,firstmatch=on,subquery_materialization_cost_based=on,use_index_extensions=on |
| optimizer_trace| enabled=off,one_line=off  |
| optimizer_trace_features | greedy_search=on,range_optimizer=on,dynamic_range=on,repeated_subselect=on  |
| optimizer_trace_limit    | 1|
| optimizer_trace_max_mem_size  | 16384 |
| optimizer_trace_offset   | -1    |
| performance_schema  | ON    |
| performance_schema_accounts_size   | 100   |
| performance_schema_digests_size    | 10000 |
| performance_schema_events_stages_history_long_size| 10000 |
| performance_schema_events_stages_history_size| 10    |
| performance_schema_events_statements_history_long_size | 10000 |
| performance_schema_events_statements_history_size | 10    |
| performance_schema_events_waits_history_long_size | 10000 |
| performance_schema_events_waits_history_size | 10    |
| performance_schema_hosts_size | 100   |
| performance_schema_max_cond_classes| 80    |
| performance_schema_max_cond_instances   | 6948  |
| performance_schema_max_file_classes| 50    |
| performance_schema_max_file_handles| 32768 |
| performance_schema_max_file_instances   | 7856  |
| performance_schema_max_mutex_classes    | 200   |
| performance_schema_max_mutex_instances  | 21240 |
| performance_schema_max_rwlock_classes   | 40    |
| performance_schema_max_rwlock_instances | 10944 |
| performance_schema_max_socket_classes   | 10    |
| performance_schema_max_socket_instances | 2020  |
| performance_schema_max_stage_classes    | 150   |
| performance_schema_max_statement_classes| 176   |
| performance_schema_max_table_handles    | 4096  |
| performance_schema_max_table_instances  | 12500 |
| performance_schema_max_thread_classes   | 50    |
| performance_schema_max_thread_instances | 2100  |
| performance_schema_session_connect_attrs_size| 512   |
| performance_schema_setup_actors_size    | 100   |
| performance_schema_setup_objects_size   | 100   |
| performance_schema_users_size | 100   |
| pid_file  | /home/mysql/sql01.<STRIPPED>.com.pid |
| plugin_dir| /usr/local/lib/mysql/plugin/   |
| port | 3306  |
| preload_buffer_size | 32768 |
| profiling | OFF   |
| profiling_history_size   | 15    |
| protocol_version    | 10    |
| query_alloc_block_size   | 8192  |
| query_cache_limit   | 1048576    |
| query_cache_min_res_unit | 2048  |
| query_cache_size    | 268435456  |
| query_cache_strip_comments    | ON    |
| query_cache_type    | ON    |
| query_cache_wlock_invalidate  | OFF   |
| query_prealloc_size | 8192  |
| range_alloc_block_size   | 4096  |
| read_buffer_size    | 1048576    |
| read_only | OFF   |
| read_rnd_buffer_size| 4194304    |
| relay_log | /home/mysql/mysql-relay-bin    |
| relay_log_basename  | /home/mysql/mysql-relay-bin    |
| relay_log_index| /home/mysql/mysql-relay-bin.index   |
| relay_log_info_file | relay-log.info  |
| relay_log_info_repository| TABLE |
| relay_log_purge| ON    |
| relay_log_recovery  | ON    |
| relay_log_space_limit    | 0|
| report_host    |  |
| report_password|  |
| report_port    | 3306  |
| report_user    |  |
| rpl_stop_slave_timeout   | 31536000   |
| secure_auth    | ON    |
| secure_file_priv    |  |
| server_id | 72    |
| server_id_bits | 32    |
| server_uuid    | <SNIP>|
| skip_external_locking    | ON    |
| skip_name_resolve   | OFF   |
| skip_networking| OFF   |
| skip_show_database  | OFF   |
| slave_allow_batching| OFF   |
| slave_checkpoint_group   | 512   |
| slave_checkpoint_period  | 300   |
| slave_compressed_protocol| OFF   |
| slave_exec_mode| STRICT|
| slave_load_tmpdir   | /home/mysql/tmp/|
| slave_max_allowed_packet | 1073741824 |
| slave_net_timeout   | 3600  |
| slave_parallel_workers   | 0|
| slave_pending_jobs_size_max   | 16777216   |
| slave_rows_search_algorithms  | TABLE_SCAN,INDEX_SCAN|
| slave_skip_errors   | OFF   |
| slave_sql_verify_checksum| ON    |
| slave_transaction_retries| 10    |
| slave_type_conversions   |  |
| slow_launch_time    | 2|
| slow_query_log | ON    |
| slow_query_log_always_write_time   | 10.000000  |
| slow_query_log_file | /home/mysql/mysql-slow.log|
| slow_query_log_timestamp_always    | OFF   |
| slow_query_log_timestamp_precision | second|
| slow_query_log_use_global_control  |  |
| socket    | /tmp/mysql.sock |
| sort_buffer_size    | 1048576    |
| sql_auto_is_null    | OFF   |
| sql_big_selects| ON    |
| sql_buffer_result   | OFF   |
| sql_log_bin    | ON    |
| sql_log_off    | OFF   |
| sql_mode  | NO_ENGINE_SUBSTITUTION    |
| sql_notes | ON    |
| sql_quote_show_create    | ON    |
| sql_safe_updates    | OFF   |
| sql_select_limit    | 18446744073709551615 |
| sql_slave_skip_counter   | 0|
| sql_warnings   | OFF   |
| ssl_ca    |  |
| ssl_capath|  |
| ssl_cert  |  |
| ssl_cipher|  |
| ssl_crl   |  |
| ssl_crlpath    |  |
| ssl_key   |  |
| storage_engine | InnoDB|
| stored_program_cache| 256   |
| sync_binlog    | 0|
| sync_frm  | ON    |
| sync_master_info    | 10000 |
| sync_relay_log | 10000 |
| sync_relay_log_info | 10000 |
| system_time_zone    | CET   |
| table_definition_cache   | 1424  |
| table_open_cache    | 2048  |
| table_open_cache_instances    | 1|
| thread_cache_size   | 16    |
| thread_concurrency  | 16    |
| thread_handling| one-thread-per-connection |
| thread_pool_high_prio_mode    | transactions    |
| thread_pool_high_prio_tickets | 4294967295 |
| thread_pool_idle_timeout | 60    |
| thread_pool_max_threads  | 100000|
| thread_pool_oversubscribe| 3|
| thread_pool_size    | 16    |
| thread_pool_stall_limit  | 500   |
| thread_stack   | 262144|
| thread_statistics   | OFF   |
| time_format    | %H:%i:%s   |
| time_zone | SYSTEM|
| timed_mutexes  | OFF   |
| tmp_table_size | 33554432   |
| tmpdir    | /home/mysql/tmp/|
| transaction_alloc_block_size  | 8192  |
| transaction_prealloc_size| 4096  |
| tx_isolation   | REPEATABLE-READ |
| tx_read_only   | OFF   |
| unique_checks  | ON    |
| updatable_views_with_limit    | YES   |
| userstat  | OFF   |
| version   | 5.6.15-log |
| version_comment| Source distribution  |
| version_compile_machine  | amd64 |
| version_compile_os  | FreeBSD8.3 |
| wait_timeout   | 300   |
474 rows in set (0.00 sec)
  • could you share the table structure? – Marshall Mathers Jan 12 '15 at 13:21
1

Your indexes involve all of 4 fields in the table. i.e. PK implicitly exists in all other secondary indexes. After each insert/update/delete, the indexes will be re-organizes, and from time to time will be optimized, which lead to slow queries some times. One way to improve that is to optimize the indexes, and that is highly dependent on the queries you run.

For example, for your delete query, you need an index on filter only.

Optimizing indexes helps in doing less memory paging, and higher hit ration for cached data.

0

Because reducing query_cache_size to 256MB helped, please consider reducing again by 50%. Some advisors suggest limiting query_cache_size to 50MB to reduce query_cache overhead.

If you could share SHOW GLOBAL STATUS and SHOW GLOBAL VARIABLES, we would have opportunity to look at other likely contributing factors.

Thanks for your details.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.