Query History timeframe

INMOVES's profile image INMOVES posted 8 years ago in General Permalink

Today I found out the hard way that the query history gets erased, probably based on the time. My experience was especially painful, since I saw the query I wanted to re-use, did something else and then it was gone :-( My bad - however, with some tweaking I could get it from the 'erased' section in the registry datafile.

That said, would it be an idea to add a configuration option saying how large the history can be (per server) and/or how old the statement is before it gets erased?

Frank

INMOVES's profile image INMOVES posted 8 years ago Permalink

(sorry, this probably should have been filed under 'feature discussion')

ansgar's profile image ansgar posted 8 years ago Permalink

Some background on the current query history implementation in HeidiSQL:

  • storing the query history is optional, activated by default, can be disabled in Tools > Preferences > Logging
  • only successful queries are logged, which did not generate some server error
  • only a bunch of up to 5 at once executed queries are stored. Bigger bunches are seen as batch/backup script, which would just blow up the history.
  • the queries need to be smaller than 1MB, otherwise they're again seen as some backup/batch script
  • the history as a whole also has a maximum of 1MB (per session/server). So if you execute a 1MB query multiple times, you will never have more than this one in the history. This is a bit illogical, the whole history should have a greater maximum than a single item in it.
  • old items are deleted when you execute the same query once again, so you never have the same query more than once in the history
  • items older than 30 days are automatically deleted

And now you want some custom setting to define the maximum history size? You are the first one asking for that.

From my experience, users tend to want more customizations, and then forget about such settings. I'm not quite convinced we need a custom setting here. Also because the value of 1MB should be big enough, isn't it?

INMOVES's profile image INMOVES posted 8 years ago Permalink

Thanks for the background info. I am using this feature because it happens quite often that someone asks me to do "what you did x days/weeks/months ago". Most of the times it was back then asked as a one-off, so I rely on the query history to get it back. On Linux the mysql_history file goes back quite far and for some reason I thought the HeidiSQL feature did the same...

I think all points you raise are fine, the only thing I would like to change (configurable) is the 30 day clean sweep. If I could change the (default) 30 into 365 (max) I would be helped enormously ;-)

Frank

Code modification/commit 444a5bd from ansgarbecker, 8 years ago, revision 9.4.0.5168
Add custom setting for number of days to keep queries in the query history. See https://www.heidisql.com/forum.php?t=23530
ansgar's profile image ansgar posted 8 years ago Permalink

New "days" setting added in r5168. Please update and give feedback if that works for you. (See the "Logging" tab on the preferences window to see the new setting)

Please login to leave a reply, or register at first.