Avoid re-loading completion from the history file after each query#13086
Conversation
By default replxx reload history from the file in replxx::Replxx::history_save(), and this will overlaps current session history with the history from other sessions, and this does not looks a great idea (bash and other interpreters don't do this). So to avoid this, use separate replxx::Replxx instance.
|
But when we save history from different clients, all histories should be saved. |
|
The code looks Ok. |
|
This is significant change for changelog, please edit the description accordingly. |
By default, but can be enabled in bash: shopt -s histappend
# or proper append ...
PROMPT_COMMAND='history -a'
Agree, bash is completely unusable w/o this
Ok |
|
I usually have 10s of tabs with bash opened and I would prefer shared history on every server. You said that according to your experience, it's not convenient for clickhouse-client... Ok but I don't understand why. |
You mean inter-server history?
I'm running multiple instances of clickhouse-client that are for different things, and when I write something in one, I get the same query in another, that is not what I want (for me the history should be saved but should not be reloaded after each query execution) Looks like you don't need/want this, then how about add an option for this? |
No, option is too complex, no one will use it. |
|
Looks like |
|
After this PR client started to be extremely slow in debug build (about 0.5 seconds per query) in interactive mode. Revert? |
@alexey-milovidov let me fix it in another way |
|
@alexey-milovidov How about ClickHouse/replxx#10 ? (After I will submit PR that uses this flag) |
This replxx object is pretty heavy and in debug build may slow down [1] (although I cannot confirm 0.5s delay for each query in debug build) the client and besides it is not required since ClickHouse/replxx#10, which changes the behaviour of history_save(), and now it will not update current session anymore, only save the history to the disk. [1]: ClickHouse#13086 (comment)
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
Avoid re-loading completion from the history file after each query (to avoid history overlaps with other client sessions)
By default replxx reload history from the file in
replxx::Replxx::history_save(), and this will overlaps current session
history with the history from other sessions, and this does not looks a
great idea (bash and other interpreters don't do this).
So to avoid this, use separate replxx::Replxx instance.
Refs: #11453