Pt-find - Can I return --exec select result?

I would like to return the max(id) from a table using pt-find.

pt-find   -h -P 3306 -u admindb -p $admindbpw -D prodrptdb  \
     --exec "select max(id) from GFxPRoduction "

This is all I see when running it.

+ pt-find -h -P 3306 -u admindb -p dep768intel -D prodrptdb --exec 'select max(id) from GFxPRoduction  '

# A software update is available:
1 Like

pt-find requires you to first “find” something and then you can ‘exec’ on what you found. In your example, you do not have anything to find, thus your exec does nothing. Check out the documentation for more info.

As a side note, why are you using pt-find for this? You can do this by simply using the mysql client:

mysql -h -u admindb -p${admindbpw} prodrptdb -e "select max(id) from GFxPRoduction"

Using the client like this is far more efficient than using pt-find.

1 Like