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. 【转】Activity、Window、View的关系

    1.先看一个现象 1 2 3 4 5 6 7 8 9 10 11 public class MainActivity extends Activity {       @Override     pr ...

  2. 2016 ACM/ICPC亚洲区大连站 F - Detachment 【维护前缀积、前缀和、二分搜索优化】

    F - Detachment In a highly developed alien society, the habitats are almost infinite dimensional spa ...

  3. 使用TimeSpan对象获取时间间隔

    实现效果: 关键知识: TimeSpan对象表是时间间隔或持续时间,两个DateTime对象相减,则会得到一个TimeSpan对象 使用其days ,hours,minutes等属性 实现代码: pr ...

  4. H5与安卓、IOS的交互,判断微信、移动设备、安卓、ios

    一.通过用户代理可以判断网页当前所在的环境 var browser={ versions:function(){ var u = navigator.userAgent, app = navigato ...

  5. application配置和profile隔离配置

    前言 github: https://github.com/vergilyn/SpringBootDemo 说明:我代码的结构是用profile来区分/激活要加载的配置,从而在一个project中写各 ...

  6. 【洛谷P1272】 重建道路

    重建道路 题目链接 一场可怕的地震后,人们用N个牲口棚(1≤N≤150,编号1..N)重建了农夫John的牧场.由于人们没有时间建设多余的道路,所以现在从一个牲口棚到另一个牲口棚的道路是惟一的.因此, ...

  7. 【洛谷P3853】 [TJOI2007]路标设置

    路标设置 题目链接 此题和跳石头很相似,都是二分答案,模拟判断是否可行 #include<iostream> #include<cstdio> using namespace ...

  8. PAT1064. Complete Binary Search Tree

    1064. Complete Binary Search Tree 题目大意 给定一个序列, 求其 生成Complete BST 的层序遍历. 思路 最开始把这个题想复杂了, 还想着建立结构体, 其实 ...

  9. 不使用C++ 11的整数转字符串

    蓝桥杯不支持C++11,那么to_string方法就用不了了.C语言提供了一种方法. 首先需要头文件 #include <sstream> 然后进行下面的操作就可以,缺点就是比较耗时. # ...

  10. HDFS的存储策略

    本文介绍hdfs的存储策略 内容译自:http://hadoop.apache.org/docs/r2.8.0/hadoop-project-dist/hadoop-hdfs/ArchivalStor ...