To manually clear query history, delete query.txt in your Share folder.
To disable the feature, you can set the read-only file attribute on query.txt in your Share folder. This will result in an annoying messagebox every time you enter a new query, but it doesn't cause any problems.