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. 2018.12.21 如何在现有的Eclipse(4.9.0版本)中安装STS (Spring Tool Suite ) Mac环境下

    在Eclipse中安装STS正确步骤实现方式 1.简介说明       spring Tool Suite(sts)就是一个基于Eclipse的开发环境, 用于开发Spring应用程序.它提供了一个现 ...

  2. js 跳转整理

    js方式的页面跳转1.window.location.href方式    <script language="javascript" type="text/java ...

  3. 原生js 异步请求,responseXML解析

    异步更新原理:用XMLHTTP发送请求得到服务器端应答数据,在不重新载入整个页面的情况下,用js操作Dom最终更新页面1.创建XMLHttp请求协议 function createXMLHttpReq ...

  4. 【洛谷P2470】[SCOI2007]压缩

    压缩 #include<iostream> #include<cstring> #include<cstdio> using namespace std; #def ...

  5. Openresty最佳案例 | 汇总

    转载请标明出处: http://blog.csdn.net/forezp/article/details/78616856 本文出自方志朋的博客 目录 Openresty最佳案例 | 第1篇:Ngin ...

  6. oracle 的分页查询与mysql 的分页查询

    oracle 的分页查询: select * from (select o.*,rownum rn  from Persons o) where rn >40 and rn <=60 : ...

  7. 论REST架构与传统MVC

    一前言 :   由于 REST 可以降低开发的复杂度,提高系统的可伸缩性,增强系统的可扩展性,简化应用系统之间的集成,因而得到了广大开发人员的喜爱,同时得到了业界广泛的支持.比如 IBM,Google ...

  8. oracle日常监控语句

    oracle常用的性能监控SQL语句 一.查询历史SQL: ---正在执行的SQL语句: select a.username, a.sid,b.SQL_TEXT, b.SQL_FULLTEXT fro ...

  9. iOS 让视图UIView单独显示某一侧的边框线

    iOS 让视图UIView 单独显示某一侧的边框线   有时候需要让view显示某一侧的边框线,这时设置layer的border是达不到效果的.在网上查阅资料发现有一个投机取巧的办法,原理是给view ...

  10. Linux mongodb安装、启动、运行

    1.下载     wget http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-3.2.4.tgz     2.安装     tar -zxvf  ...