4

I am performing some MySQL queries that have very large result sets. I would like to see how long they take, but I don't want all the output to be printed on my terminal because it takes up a lot of space and time. I can do this by writing a script that performs and times the query, but I was wondering if there was a way to do this directly through MySQL on the terminal. Thanks.

3 Answers 3

20

Change the pager in mysql like indicated here: http://www.mysqlperformanceblog.com/2013/01/21/fun-with-the-mysql-pager-command/

mysql> pager cat > /dev/null will discard the output, and mysql> pager will put it back.

Sign up to request clarification or add additional context in comments.

Comments

5

Wrap your query in set @foo = (select count(*) from ( ..... ) foo)

2 Comments

this only seems to work for a single value which really limits the query
@ejectamenta: if you just have a single value, it can be shortened to set @foo = (.....); with the select count...foo wrapper around it, you can put selects that return multiple values where I have .....
-1

Just run mysql console utility, then enter source file_name (where file_name contains sql commands)

1 Comment

I created a test.sql that has a simple command (select * from table limit 100) and ran "source test.sql". It runs the command, but still prints out the output.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.