JohnHenry
JohnHenry

Reputation: 515

What is the 'Query' MySQL data file used for?

I am having some real difficulties finding out exactly what a certain file in the MySQL data directory is used for. (Using Google with its file name is pointless!)

Basically, I need to create some space on the drive that hosts all MySQL data and have noticed a file almost 16GB in size!!

I cant see any reference to a Query file in my config file nor can I match its size up to that of any log files, etc (in case its a log file missing the .log extension). I'm totally stumped!

enter image description here

I would like to know what this file is and how to reduce its size if at all possible?

Thanks in advance for your assistance!

Upvotes: 0

Views: 191

Answers (1)

Jürgen Steinblock
Jürgen Steinblock

Reputation: 31733

That could be the general query log (I said "could" because the name can be configured by yourself). Look in your my.ini for an entry

log=/path/to/query

Or start the MySQL Administrator, goto "Startup Variables->Log Files" and look for "Query Logfile"

That file is completely unnessasary for your server to run (if you confirmed that the entry log=... exists in your config. It is just good for debugging.

Try stopping your mysql server, delete it and restart your server again. The file will be recreated.

I also noticed that the slow-query-log ("diamond-slow-log") is large, too. That file only logs queries that take longer than x seconds (2 by default). That file can be deleted or deactivated, too. But I would keep it since it contains queries that could easily be optimized with an extra index.

Update

there is another way, to confirm that this is the general query log. Download a windows port of the tail unix command. E.g. this one http://tailforwin32.sourceforge.net/

I often use this on my dev machine to see what is goning on.

Open a shell (cmd.exe) and navigate the folder where that file exists. Then type

tail -f query

That will print the last few lines of the file and if the file changes every new line. So if you do a SELECT * FROM table you should see the query in the console output.

Upvotes: 2

Related Questions