Search
left arrowBack
Sergey Nikolaev

Sergey Nikolaev

November 22, 2011 ・ Sphinx

Email me mysql/sphinx query result

Hi. Here's just a simple trick which can be useful if you run some long-lasting mysql/sphinx query in a screen or whatever and want to get informed as soon as it's finished. This works on mysql client level and applicable to MySQL and SphinxQL:

The trick is to use "pager" directive to redirect the output to a mail program:

mysql> pager mail -s "subject" yourname@yourdomain.com
PAGER set to 'mail -s "subject" yourname@yourdomain.com'

The above will redirect the output to yourname@yourdomain.com and the subject will be "subject".

Then just start your long-lasting query to MySQL:

mysql> select count(*) from feed where ext_key like 'a%';
1 row in set (10 min 35.88 sec)

or SphinxQL:

mysql> select * from huge_index;
20 rows in set (1 min 14.00 sec)

and be informed via email.

  • Sphinx
  • Code