Preface
 
    We used to use "find" command in linux or AIX when we need to get a certain file but cannot rember the precise name.We will execute "find /pathtobegin -name xxx" in our OS prompt.Is there any tool can find a specific table of MySQL database which similarly as "find" does?
 
Introduce
 
    pt-find is a very useful tool to find out a sepcific table with a condition you've specified.It even can execute a sql operation when finding it simutaneously.
 
Procedure
 
Usage
 pt-find [OPTIONS] [DATABASES]

Common parameters

 Options:
--day-start //Specify the meassure mothed of time when using "--cmin,--mmin,--ctime,--mtime,etc".
--or //Change the combination test behavior as "or" instead of default "and". Actions:
--exec //Specify the executing sql statement with each item found.
--exec-plus //Specify the executing sql statement with all items at once.
--print //Print the target database and table name.
--printf //Print with a certain format. Tests:
--autoinc //Speicfy a value of auto_increment to test whether has auto_inrcrement column.
--avgrowlen //Specify the average
--cmin //Specify the target table created n minutes ago.
--ctime //Specify the target table created n days ago.
--mmin //Specify the target table modified n minutes ago.
--mtime //Specify the target table modified n days ago.
--kmim //Specify the target table checked n minutes ago.
--ktime //Specify the target table checked n days ago.
--rowformat //Specify the row format of tables to match pattern.
--rows //Specify the rows the table contains.
--tablesize //Specify the size the table is.
--empty //Specify the talbe which has no rows.
--engines //Specify the engine of tabls.
Example
 
Find out all tables in all databases.
 [root@zlm2 :: /data/mysql/mysql3308/data]
#pt-find -h192.168.1. -P3308 -uzlm -pzlmzlm
`mysql`.`columns_priv`
`mysql`.`db`
`mysql`.`engine_cost`
`mysql`.`event`
`mysql`.`func`
`mysql`.`general_log`
`mysql`.`gtid_executed`
`mysql`.`help_category`
`mysql`.`help_keyword`
`mysql`.`help_relation`
`mysql`.`help_topic`
`mysql`.`innodb_index_stats`
`mysql`.`innodb_table_stats`
`mysql`.`ndb_binlog_index`
`mysql`.`plugin`
`mysql`.`proc`
`mysql`.`procs_priv`
`mysql`.`proxies_priv`
`mysql`.`server_cost`
`mysql`.`servers`
`mysql`.`slave_master_info`
`mysql`.`slave_relay_log_info`
`mysql`.`slave_worker_info`
`mysql`.`slow_log`
`mysql`.`tables_priv`
`mysql`.`time_zone`
`mysql`.`time_zone_leap_second`
`mysql`.`time_zone_name`
`mysql`.`time_zone_transition`
`mysql`.`time_zone_transition_type`
`mysql`.`user`
`performance_schema`.`accounts`
`performance_schema`.`cond_instances`
`performance_schema`.`events_stages_current`
`performance_schema`.`events_stages_history`
`performance_schema`.`events_stages_history_long`
`performance_schema`.`events_stages_summary_by_account_by_event_name`
`performance_schema`.`events_stages_summary_by_host_by_event_name`
`performance_schema`.`events_stages_summary_by_thread_by_event_name`
`performance_schema`.`events_stages_summary_by_user_by_event_name`
`performance_schema`.`events_stages_summary_global_by_event_name`
`performance_schema`.`events_statements_current`
`performance_schema`.`events_statements_history`
`performance_schema`.`events_statements_history_long`
`performance_schema`.`events_statements_summary_by_account_by_event_name`
`performance_schema`.`events_statements_summary_by_digest`
`performance_schema`.`events_statements_summary_by_host_by_event_name`
`performance_schema`.`events_statements_summary_by_program`
`performance_schema`.`events_statements_summary_by_thread_by_event_name`
`performance_schema`.`events_statements_summary_by_user_by_event_name`
`performance_schema`.`events_statements_summary_global_by_event_name`
`performance_schema`.`events_transactions_current`
`performance_schema`.`events_transactions_history`
`performance_schema`.`events_transactions_history_long`
`performance_schema`.`events_transactions_summary_by_account_by_event_name`
`performance_schema`.`events_transactions_summary_by_host_by_event_name`
`performance_schema`.`events_transactions_summary_by_thread_by_event_name`
`performance_schema`.`events_transactions_summary_by_user_by_event_name`
`performance_schema`.`events_transactions_summary_global_by_event_name`
`performance_schema`.`events_waits_current`
`performance_schema`.`events_waits_history`
`performance_schema`.`events_waits_history_long`
`performance_schema`.`events_waits_summary_by_account_by_event_name`
`performance_schema`.`events_waits_summary_by_host_by_event_name`
`performance_schema`.`events_waits_summary_by_instance`
`performance_schema`.`events_waits_summary_by_thread_by_event_name`
`performance_schema`.`events_waits_summary_by_user_by_event_name`
`performance_schema`.`events_waits_summary_global_by_event_name`
`performance_schema`.`file_instances`
`performance_schema`.`file_summary_by_event_name`
`performance_schema`.`file_summary_by_instance`
`performance_schema`.`global_status`
`performance_schema`.`global_variables`
`performance_schema`.`host_cache`
`performance_schema`.`hosts`
`performance_schema`.`memory_summary_by_account_by_event_name`
`performance_schema`.`memory_summary_by_host_by_event_name`
`performance_schema`.`memory_summary_by_thread_by_event_name`
`performance_schema`.`memory_summary_by_user_by_event_name`
`performance_schema`.`memory_summary_global_by_event_name`
`performance_schema`.`metadata_locks`
`performance_schema`.`mutex_instances`
`performance_schema`.`objects_summary_global_by_type`
`performance_schema`.`performance_timers`
`performance_schema`.`prepared_statements_instances`
`performance_schema`.`pxc_cluster_view`
`performance_schema`.`replication_applier_configuration`
`performance_schema`.`replication_applier_status`
`performance_schema`.`replication_applier_status_by_coordinator`
`performance_schema`.`replication_applier_status_by_worker`
`performance_schema`.`replication_connection_configuration`
`performance_schema`.`replication_connection_status`
`performance_schema`.`replication_group_member_stats`
`performance_schema`.`replication_group_members`
`performance_schema`.`rwlock_instances`
`performance_schema`.`session_account_connect_attrs`
`performance_schema`.`session_connect_attrs`
`performance_schema`.`session_status`
`performance_schema`.`session_variables`
`performance_schema`.`setup_actors`
`performance_schema`.`setup_consumers`
`performance_schema`.`setup_instruments`
`performance_schema`.`setup_objects`
`performance_schema`.`setup_timers`
`performance_schema`.`socket_instances`
`performance_schema`.`socket_summary_by_event_name`
`performance_schema`.`socket_summary_by_instance`
`performance_schema`.`status_by_account`
`performance_schema`.`status_by_host`
`performance_schema`.`status_by_thread`
`performance_schema`.`status_by_user`
`performance_schema`.`table_handles`
`performance_schema`.`table_io_waits_summary_by_index_usage`
`performance_schema`.`table_io_waits_summary_by_table`
`performance_schema`.`table_lock_waits_summary_by_table`
`performance_schema`.`threads`
`performance_schema`.`user_variables_by_thread`
`performance_schema`.`users`
`performance_schema`.`variables_by_thread`
`sys`.`host_summary`
`sys`.`host_summary_by_file_io`
`sys`.`host_summary_by_file_io_type`
`sys`.`host_summary_by_stages`
`sys`.`host_summary_by_statement_latency`
`sys`.`host_summary_by_statement_type`
`sys`.`innodb_buffer_stats_by_schema`
`sys`.`innodb_buffer_stats_by_table`
`sys`.`innodb_lock_waits`
`sys`.`io_by_thread_by_latency`
`sys`.`io_global_by_file_by_bytes`
`sys`.`io_global_by_file_by_latency`
`sys`.`io_global_by_wait_by_bytes`
`sys`.`io_global_by_wait_by_latency`
`sys`.`latest_file_io`
`sys`.`memory_by_host_by_current_bytes`
`sys`.`memory_by_thread_by_current_bytes`
`sys`.`memory_by_user_by_current_bytes`
`sys`.`memory_global_by_current_bytes`
`sys`.`memory_global_total`
`sys`.`metrics`
`sys`.`processlist`
`sys`.`ps_check_lost_instrumentation`
`sys`.`schema_auto_increment_columns`
`sys`.`schema_index_statistics`
`sys`.`schema_object_overview`
`sys`.`schema_redundant_indexes`
`sys`.`schema_table_lock_waits`
`sys`.`schema_table_statistics`
`sys`.`schema_table_statistics_with_buffer`
`sys`.`schema_tables_with_full_table_scans`
`sys`.`schema_unused_indexes`
`sys`.`session`
`sys`.`session_ssl_status`
`sys`.`statement_analysis`
`sys`.`statements_with_errors_or_warnings`
`sys`.`statements_with_full_table_scans`
`sys`.`statements_with_runtimes_in_95th_percentile`
`sys`.`statements_with_sorting`
`sys`.`statements_with_temp_tables`
`sys`.`sys_config`
`sys`.`user_summary`
`sys`.`user_summary_by_file_io`
`sys`.`user_summary_by_file_io_type`
`sys`.`user_summary_by_stages`
`sys`.`user_summary_by_statement_latency`
`sys`.`user_summary_by_statement_type`
`sys`.`version`
`sys`.`wait_classes_global_by_avg_latency`
`sys`.`wait_classes_global_by_latency`
`sys`.`waits_by_host_by_latency`
`sys`.`waits_by_user_by_latency`
`sys`.`waits_global_by_latency`
`sys`.`x$host_summary`
`sys`.`x$host_summary_by_file_io`
`sys`.`x$host_summary_by_file_io_type`
`sys`.`x$host_summary_by_stages`
`sys`.`x$host_summary_by_statement_latency`
`sys`.`x$host_summary_by_statement_type`
`sys`.`x$innodb_buffer_stats_by_schema`
`sys`.`x$innodb_buffer_stats_by_table`
`sys`.`x$innodb_lock_waits`
`sys`.`x$io_by_thread_by_latency`
`sys`.`x$io_global_by_file_by_bytes`
`sys`.`x$io_global_by_file_by_latency`
`sys`.`x$io_global_by_wait_by_bytes`
`sys`.`x$io_global_by_wait_by_latency`
`sys`.`x$latest_file_io`
`sys`.`x$memory_by_host_by_current_bytes`
`sys`.`x$memory_by_thread_by_current_bytes`
`sys`.`x$memory_by_user_by_current_bytes`
`sys`.`x$memory_global_by_current_bytes`
`sys`.`x$memory_global_total`
`sys`.`x$processlist`
`sys`.`x$ps_digest_95th_percentile_by_avg_us`
`sys`.`x$ps_digest_avg_latency_distribution`
`sys`.`x$ps_schema_table_statistics_io`
`sys`.`x$schema_flattened_keys`
`sys`.`x$schema_index_statistics`
`sys`.`x$schema_table_lock_waits`
`sys`.`x$schema_table_statistics`
`sys`.`x$schema_table_statistics_with_buffer`
`sys`.`x$schema_tables_with_full_table_scans`
`sys`.`x$session`
`sys`.`x$statement_analysis`
`sys`.`x$statements_with_errors_or_warnings`
`sys`.`x$statements_with_full_table_scans`
`sys`.`x$statements_with_runtimes_in_95th_percentile`
`sys`.`x$statements_with_sorting`
`sys`.`x$statements_with_temp_tables`
`sys`.`x$user_summary`
`sys`.`x$user_summary_by_file_io`
`sys`.`x$user_summary_by_file_io_type`
`sys`.`x$user_summary_by_stages`
`sys`.`x$user_summary_by_statement_latency`
`sys`.`x$user_summary_by_statement_type`
`sys`.`x$wait_classes_global_by_avg_latency`
`sys`.`x$wait_classes_global_by_latency`
`sys`.`x$waits_by_host_by_latency`
`sys`.`x$waits_by_user_by_latency`
`sys`.`x$waits_global_by_latency`
`zlm`.`t1`
`zlm`.`t2` //It shows all the tables in all databases one line each table.

Find out all the MyISAM tables.

 [root@zlm2 :: /data/mysql/mysql3308/data]
#pt-find -h192.168.1. -P3308 -uzlm -pzlmzlm --engine=MyISAM
`mysql`.`columns_priv`
`mysql`.`db`
`mysql`.`event`
`mysql`.`func`
`mysql`.`ndb_binlog_index`
`mysql`.`proc`
`mysql`.`procs_priv`
`mysql`.`proxies_priv`
`mysql`.`tables_priv`
`mysql`.`user`

Find out all the tables in database "zlm" which does not have auto_increment column.

 [root@zlm2 :: /data/mysql/mysql3308/data]
#pt-find -h192.168.1. -P3308 -uzlm -pzlmzlm --dblike=zlm --autoinc=
`zlm`.`t1`
`zlm`.`t2`

Find out all the tables which is empty.

 [root@zlm2 :: /data/mysql/mysql3308/data]
#pt-find -h192.168.1. -P3308 -uzlm -pzlmzlm --empty
`mysql`.`columns_priv`
`mysql`.`event`
`mysql`.`func`
`mysql`.`ndb_binlog_index`
`mysql`.`plugin`
`mysql`.`procs_priv`
`mysql`.`servers`
`mysql`.`slave_master_info`
`mysql`.`slave_relay_log_info`
`mysql`.`slave_worker_info`
`mysql`.`time_zone`
`mysql`.`time_zone_leap_second`
`mysql`.`time_zone_name`
`mysql`.`time_zone_transition`
`mysql`.`time_zone_transition_type`
`performance_schema`.`metadata_locks`
`performance_schema`.`prepared_statements_instances`
`performance_schema`.`replication_group_member_stats`
`performance_schema`.`replication_group_members`

Find out all the tables sorted descendingly by size.

 [root@zlm2 :: /data/mysql/mysql3308/data]
#pt-find -h192.168.1. -P3308 -uzlm -pzlmzlm --printf "%T\t%D.%N\n" | sort -rn
`mysql`.`help_topic`
`mysql`.`proc`
`mysql`.`help_keyword`
`mysql`.`help_relation`
`mysql`.`help_category`
`zlm`.`t2`
`zlm`.`t1`
`sys`.`sys_config`
`mysql`.`time_zone_transition_type`
`mysql`.`time_zone_transition`
`mysql`.`time_zone_name`
`mysql`.`time_zone_leap_second`
`mysql`.`time_zone`
`mysql`.`slave_worker_info`
`mysql`.`slave_relay_log_info`
`mysql`.`slave_master_info`
`mysql`.`servers`
`mysql`.`server_cost`
`mysql`.`plugin`
`mysql`.`innodb_table_stats`
`mysql`.`innodb_index_stats`
`mysql`.`gtid_executed`
`mysql`.`engine_cost`
`mysql`.`tables_priv`
`mysql`.`proxies_priv`
`mysql`.`db`
`mysql`.`user`
`mysql`.`procs_priv`
`mysql`.`columns_priv`
`mysql`.`event`
`mysql`.`ndb_binlog_index`
`mysql`.`func`
`sys`.`x$waits_global_by_latency`
`sys`.`x$waits_by_user_by_latency`
`sys`.`x$waits_by_host_by_latency`
`sys`.`x$wait_classes_global_by_latency`
`sys`.`x$wait_classes_global_by_avg_latency`
`sys`.`x$user_summary_by_statement_type`
`sys`.`x$user_summary_by_statement_latency`
`sys`.`x$user_summary_by_stages`
`sys`.`x$user_summary_by_file_io_type`
`sys`.`x$user_summary_by_file_io`
`sys`.`x$user_summary`
`sys`.`x$statements_with_temp_tables`
`sys`.`x$statements_with_sorting`
`sys`.`x$statements_with_runtimes_in_95th_percentile`
`sys`.`x$statements_with_full_table_scans`
`sys`.`x$statements_with_errors_or_warnings`
`sys`.`x$statement_analysis`
`sys`.`x$session`
`sys`.`x$schema_tables_with_full_table_scans`
`sys`.`x$schema_table_statistics_with_buffer`
`sys`.`x$schema_table_statistics`
`sys`.`x$schema_table_lock_waits`
`sys`.`x$schema_index_statistics`
`sys`.`x$schema_flattened_keys`
`sys`.`x$ps_schema_table_statistics_io`
`sys`.`x$ps_digest_avg_latency_distribution`
`sys`.`x$ps_digest_95th_percentile_by_avg_us`
`sys`.`x$processlist`
`sys`.`x$memory_global_total`
`sys`.`x$memory_global_by_current_bytes`
`sys`.`x$memory_by_user_by_current_bytes`
`sys`.`x$memory_by_thread_by_current_bytes`
`sys`.`x$memory_by_host_by_current_bytes`
`sys`.`x$latest_file_io`
`sys`.`x$io_global_by_wait_by_latency`
`sys`.`x$io_global_by_wait_by_bytes`
`sys`.`x$io_global_by_file_by_latency`
`sys`.`x$io_global_by_file_by_bytes`
`sys`.`x$io_by_thread_by_latency`
`sys`.`x$innodb_lock_waits`
`sys`.`x$innodb_buffer_stats_by_table`
`sys`.`x$innodb_buffer_stats_by_schema`
`sys`.`x$host_summary_by_statement_type`
`sys`.`x$host_summary_by_statement_latency`
`sys`.`x$host_summary_by_stages`
`sys`.`x$host_summary_by_file_io_type`
`sys`.`x$host_summary_by_file_io`
`sys`.`x$host_summary`
`sys`.`waits_global_by_latency`
`sys`.`waits_by_user_by_latency`
`sys`.`waits_by_host_by_latency`
`sys`.`wait_classes_global_by_latency`
`sys`.`wait_classes_global_by_avg_latency`
`sys`.`version`
`sys`.`user_summary_by_statement_type`
`sys`.`user_summary_by_statement_latency`
`sys`.`user_summary_by_stages`
`sys`.`user_summary_by_file_io_type`
`sys`.`user_summary_by_file_io`
`sys`.`user_summary`
`sys`.`statements_with_temp_tables`
`sys`.`statements_with_sorting`
`sys`.`statements_with_runtimes_in_95th_percentile`
`sys`.`statements_with_full_table_scans`
`sys`.`statements_with_errors_or_warnings`
`sys`.`statement_analysis`
`sys`.`session_ssl_status`
`sys`.`session`
`sys`.`schema_unused_indexes`
`sys`.`schema_tables_with_full_table_scans`
`sys`.`schema_table_statistics_with_buffer`
`sys`.`schema_table_statistics`
`sys`.`schema_table_lock_waits`
`sys`.`schema_redundant_indexes`
`sys`.`schema_object_overview`
`sys`.`schema_index_statistics`
`sys`.`schema_auto_increment_columns`
`sys`.`ps_check_lost_instrumentation`
`sys`.`processlist`
`sys`.`metrics`
`sys`.`memory_global_total`
`sys`.`memory_global_by_current_bytes`
`sys`.`memory_by_user_by_current_bytes`
`sys`.`memory_by_thread_by_current_bytes`
`sys`.`memory_by_host_by_current_bytes`
`sys`.`latest_file_io`
`sys`.`io_global_by_wait_by_latency`
`sys`.`io_global_by_wait_by_bytes`
`sys`.`io_global_by_file_by_latency`
`sys`.`io_global_by_file_by_bytes`
`sys`.`io_by_thread_by_latency`
`sys`.`innodb_lock_waits`
`sys`.`innodb_buffer_stats_by_table`
`sys`.`innodb_buffer_stats_by_schema`
`sys`.`host_summary_by_statement_type`
`sys`.`host_summary_by_statement_latency`
`sys`.`host_summary_by_stages`
`sys`.`host_summary_by_file_io_type`
`sys`.`host_summary_by_file_io`
`sys`.`host_summary`
`performance_schema`.`variables_by_thread`
`performance_schema`.`user_variables_by_thread`
`performance_schema`.`users`
`performance_schema`.`threads`
`performance_schema`.`table_lock_waits_summary_by_table`
`performance_schema`.`table_io_waits_summary_by_table`
`performance_schema`.`table_io_waits_summary_by_index_usage`
`performance_schema`.`table_handles`
`performance_schema`.`status_by_user`
`performance_schema`.`status_by_thread`
`performance_schema`.`status_by_host`
`performance_schema`.`status_by_account`
`performance_schema`.`socket_summary_by_instance`
`performance_schema`.`socket_summary_by_event_name`
`performance_schema`.`socket_instances`
`performance_schema`.`setup_timers`
`performance_schema`.`setup_objects`
`performance_schema`.`setup_instruments`
`performance_schema`.`setup_consumers`
`performance_schema`.`setup_actors`
`performance_schema`.`session_variables`
`performance_schema`.`session_status`
`performance_schema`.`session_connect_attrs`
`performance_schema`.`session_account_connect_attrs`
`performance_schema`.`rwlock_instances`
`performance_schema`.`replication_group_member_stats`
`performance_schema`.`replication_group_members`
`performance_schema`.`replication_connection_status`
`performance_schema`.`replication_connection_configuration`
`performance_schema`.`replication_applier_status_by_worker`
`performance_schema`.`replication_applier_status_by_coordinator`
`performance_schema`.`replication_applier_status`
`performance_schema`.`replication_applier_configuration`
`performance_schema`.`pxc_cluster_view`
`performance_schema`.`prepared_statements_instances`
`performance_schema`.`performance_timers`
`performance_schema`.`objects_summary_global_by_type`
`performance_schema`.`mutex_instances`
`performance_schema`.`metadata_locks`
`performance_schema`.`memory_summary_global_by_event_name`
`performance_schema`.`memory_summary_by_user_by_event_name`
`performance_schema`.`memory_summary_by_thread_by_event_name`
`performance_schema`.`memory_summary_by_host_by_event_name`
`performance_schema`.`memory_summary_by_account_by_event_name`
`performance_schema`.`hosts`
`performance_schema`.`host_cache`
`performance_schema`.`global_variables`
`performance_schema`.`global_status`
`performance_schema`.`file_summary_by_instance`
`performance_schema`.`file_summary_by_event_name`
`performance_schema`.`file_instances`
`performance_schema`.`events_waits_summary_global_by_event_name`
`performance_schema`.`events_waits_summary_by_user_by_event_name`
`performance_schema`.`events_waits_summary_by_thread_by_event_name`
`performance_schema`.`events_waits_summary_by_instance`
`performance_schema`.`events_waits_summary_by_host_by_event_name`
`performance_schema`.`events_waits_summary_by_account_by_event_name`
`performance_schema`.`events_waits_history_long`
`performance_schema`.`events_waits_history`
`performance_schema`.`events_waits_current`
`performance_schema`.`events_transactions_summary_global_by_event_name`
`performance_schema`.`events_transactions_summary_by_user_by_event_name`
`performance_schema`.`events_transactions_summary_by_thread_by_event_name`
`performance_schema`.`events_transactions_summary_by_host_by_event_name`
`performance_schema`.`events_transactions_summary_by_account_by_event_name`
`performance_schema`.`events_transactions_history_long`
`performance_schema`.`events_transactions_history`
`performance_schema`.`events_transactions_current`
`performance_schema`.`events_statements_summary_global_by_event_name`
`performance_schema`.`events_statements_summary_by_user_by_event_name`
`performance_schema`.`events_statements_summary_by_thread_by_event_name`
`performance_schema`.`events_statements_summary_by_program`
`performance_schema`.`events_statements_summary_by_host_by_event_name`
`performance_schema`.`events_statements_summary_by_digest`
`performance_schema`.`events_statements_summary_by_account_by_event_name`
`performance_schema`.`events_statements_history_long`
`performance_schema`.`events_statements_history`
`performance_schema`.`events_statements_current`
`performance_schema`.`events_stages_summary_global_by_event_name`
`performance_schema`.`events_stages_summary_by_user_by_event_name`
`performance_schema`.`events_stages_summary_by_thread_by_event_name`
`performance_schema`.`events_stages_summary_by_host_by_event_name`
`performance_schema`.`events_stages_summary_by_account_by_event_name`
`performance_schema`.`events_stages_history_long`
`performance_schema`.`events_stages_history`
`performance_schema`.`events_stages_current`
`performance_schema`.`cond_instances`
`performance_schema`.`accounts`
`mysql`.`slow_log`
`mysql`.`general_log`

Find out all the tables over 16K.

 [root@zlm2 :: /data/mysql/mysql3308/data]
#pt-find -h192.168.1. -P3308 -uzlm -pzlmzlm --tablesize +
`mysql`.`columns_priv`
`mysql`.`db`
`mysql`.`engine_cost`
`mysql`.`event`
`mysql`.`func`
`mysql`.`gtid_executed`
`mysql`.`help_category`
`mysql`.`help_keyword`
`mysql`.`help_relation`
`mysql`.`help_topic`
`mysql`.`innodb_index_stats`
`mysql`.`innodb_table_stats`
`mysql`.`ndb_binlog_index`
`mysql`.`plugin`
`mysql`.`proc`
`mysql`.`procs_priv`
`mysql`.`proxies_priv`
`mysql`.`server_cost`
`mysql`.`servers`
`mysql`.`slave_master_info`
`mysql`.`slave_relay_log_info`
`mysql`.`slave_worker_info`
`mysql`.`tables_priv`
`mysql`.`time_zone`
`mysql`.`time_zone_leap_second`
`mysql`.`time_zone_name`
`mysql`.`time_zone_transition`
`mysql`.`time_zone_transition_type`
`mysql`.`user`
`sys`.`sys_config`
`zlm`.`t1`
`zlm`.`t2`

Find out table in "zlm" database which name is like "t3" then drop it.

 (zlm@192.168.1.101 )[zlm]>create table t3 like t2;
Query OK, rows affected (0.02 sec) (zlm@192.168.1.101 )[zlm]>show create table t3\G
*************************** . row ***************************
Table: t3
Create Table: CREATE TABLE `t3` (
`id` int() NOT NULL,
`name` char() DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4
row in set (0.00 sec) (zlm@192.168.1.101 )[zlm]>show tables;
+---------------+
| Tables_in_zlm |
+---------------+
| t1 |
| t2 |
| t3 |
+---------------+
rows in set (0.00 sec) [root@zlm2 :: /data/mysql/mysql3308/data]
#pt-find -h192.168.1. -P3308 -uzlm -pzlmzlm --print zlm --tbllike=t3 --exec-plus "drop table %s"
`zlm`.`t3` (zlm@192.168.1.101 )[zlm]>show tables;
+---------------+
| Tables_in_zlm |
+---------------+
| t1 |
| t2 |
+---------------+
rows in set (0.00 sec) //The table has been droped directly by the last command in pt-find.
Summary
  • pt-find is rather useful when retrieving target table with flexible conditions you defined.
  • pt-find has a lot of options.We should be more careful when using ddl statement by "--exec" or "--exec-plus".
  • We can use it to collect the important information about a bunch of tables easily which can increse the working efficiency.

Percona-Tookit工具包之pt-find的更多相关文章

  1. Linux后台开发工具箱

    https://files-cdn.cnblogs.com/files/aquester/Linux后台开发工具箱.pdf 目录 目录 1 1. 前言 3 2. 脚本类工具 3 2.1. sed命令- ...

  2. Mysql: pt-table-checksum 和 pt-table-sync 检查主从一致性,实验过程

    一.安装 percona 包 1.安装仓库的包 https://www.percona.com/doc/percona-repo-config/yum-repo.html sudo yum insta ...

  3. Linux后台开发工具箱-葵花宝典

    Linux后台开发工具箱-葵花宝典 一见 2016/11/4 目录 目录 1 1. 前言 4 2. 脚本类工具 4 2.1. 双引号和单引号 4 2.2. 取脚本完整文件路径 5 2.3. 环境变量和 ...

  4. 推荐几款MySQL相关工具

    前言: 随着互联网技术的不断发展, MySQL 相关生态也越来越完善,越来越多的工具涌现出来.一些公司或个人纷纷开源出一些不错的工具,本篇文章主要介绍几款 MySQL 相关实用工具.提醒下,这里并不介 ...

  5. [知识库分享系列] 二、.NET(ASP.NET)

    最近时间又有了新的想法,当我用新的眼光在整理一些很老的知识库时,发现很多东西都已经过时,或者是很基础很零碎的知识点.如果分享出去大家不看倒好,更担心的是会误人子弟,但为了保证此系列的完整,还是选择分享 ...

  6. SQL慢查询安装过程

    SQL慢查询 基本操作 打开防火墙 firewall-cmd --zone=public --add-port=3306/tcp --permanent firewall-cmd --reload 安 ...

  7. 快速安装Percona pt工具

    yum install perl-DBI perl-DBD-MySQL perl-Time-HiRes perl-Time-HiRes perl-IO-Socket-SSLwget http://pk ...

  8. Percona 工具包 pt-online-schema-change 简介

    mysql的在线表结构修改,因为低效和阻塞读写.一直被诟病.至于ALTER TABLE 的原理,参看我上一篇文章.MySQL在线修改大表结构.看完后,发现的问题是还是会锁的,且对于在线更新的这块也是不 ...

  9. 安装percona工具包

    1.安装percona源 sudo yum install http://www.percona.com/downloads/percona-release/redhat/0.1-4/percona- ...

  10. percona pt toolkit 总结

    ##=====================================================##pt-osc之工作流程:1.检查更改表是否有主键或唯一索引,是否有触发器2.检查修改表 ...

随机推荐

  1. 【洛谷P2426】删数

    删数 题目链接 一道裸的区间DP,f[l][r]表示剩下区间[l,r]时的最大价值 可以由f[1~l-1][r]和f[l][r+1~n]转移过来 详见代码: #include<algorithm ...

  2. 【luoguP1086】【2004NOIP-Ua】花生采摘

    P1086 花生采摘 题目描述 鲁宾逊先生有一只宠物猴,名叫多多.这天,他们两个正沿着乡间小路散步,突然发现路边的告示牌上贴着一张小小的纸条:“欢迎免费品尝我种的花生!――熊字”. 鲁宾逊先生和多多都 ...

  3. 【luoguP1238】【NOIP2014】生活大爆炸版剪刀石头布

               生活大爆炸版剪刀石头布                      ——[传送门] 这道题可以原原本本地说得上是一道水题了,通过判断两人的出拳不同给分然后统计输出.就是对于游戏得分 ...

  4. hadoop核心逻辑shuffle代码分析-map端 (转)

    一直对书和各种介绍不太满意, 终于看到一篇比较好的了,迅速转载. 首先要推荐一下:http://www.alidata.org/archives/1470 阿里的大牛在上面的文章中比较详细的介绍了sh ...

  5. Mac通过域名查询IP地址

    Mac通过域名查询IP地址 方法一:使用Mac自带的"网络实用工具" 步骤: 搜索"网络使用工具",并打开: 点击LookUp,输入互联网地址,点击Lookup ...

  6. BFC、IFC、GFC、FFC

    原文地址:https://www.xingkongbj.com/blog/css/fc.html FC FC的全称是:Formatting Contexts,是W3C CSS2.1规范中的一个概念.它 ...

  7. 辨析:Object与Instance都是对象,概念上没有区别。

    Object与Instance有重要的区别:Object是客观世界中存在的实体:Instance是将Object虚拟到计算机世界的实例,它的生存方式是可运行的代码,它的生存环境是计算机中的内存资源,生 ...

  8. [oracle]索引与索引表管理

    (一)索引的概念 索引是一种与表或簇相关的数据库对象,能够为数据的查询提供快捷的存取路径,减少磁盘I/O,提高检索效率. 索引由索引值及记录相应物理地址的ROWID两个部分构成,并按照索引值有序排列, ...

  9. ios 判断用户是否开启权限---并跳转设置

    ios 判断用户是否开启权限---并跳转设置 ios 判断用户是否开启权限---并跳转“系统设置” 1.判断 访问相册 或 相机 权限是否开启 2.检测是否开启定位 后面将持续更新 只有在应用请求过位 ...

  10. dcm4che 的依赖无法下载

    遇到问题时我在Gradle这样引入 maven { url "http://www.dcm4che.org/maven2"} 这样使用可以解决问题 maven { url &quo ...