Reputation: 225
On MYSQL Workbench, I'm running this query : count(*) from test.nameTable
I have couple millions rows in this table .
after a while I get this error : Lost connection to MySQL server during query
I saw this question and its answers in other places but none of the answers helped.
I tried setting all timeout and packet size global variables to their maximum value, and spliting my query somehow..
But none of this methods worked.
SET GLOBAL connect_timeout=10000000
SET GLOBAL net_read_timeout=10000000
SET GLOBAL max_allowed_packet=1073741824
Anyone knows what could be the problem and how to solve it please?
Upvotes: 7
Views: 2537
Reputation: 1884
If you are running from MySQL Workbench (as I can read on your comment, please update question), the program have their own timeouts.
If you go to the program menu, preferences -> SQL Editor, you have these options:
MySQL Session: DBMS connection keep-alive interval (in seconds): DBMS connection read time out (in seconds): DBMS connection time out (in seconds):
If you read descriptions from these options, you can see on the second one there's the time who workbench wait for a response from server.
Upvotes: 3
Reputation: 49
If no row were ever deleted from the table, th primary key would describe the total count of rows, in which case you could probably try
SELECT MAX(pk) FROM test.nameTable
Not sure it would be faster, but maybe worth the try?
Upvotes: -1