HiveBrain v1.2.0
Get Started
← Back to all entries
patternMinor

Limit of psql_history

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
limitpsql_historystackoverflow

Problem

I can't find (using ctrl-r within psql and less ~/.psql_history) a particular query that I executed a couple months back. I also recently upgraded from 9.3 to 9.5 so I'm not sure if there is a limit on psql_history or if it was removed on the upgrade.

Is there a limit on the size of psql_history and, if so, how could I go about increasing it?

Thanks in advance!!

Solution

There's a psql variable that sets the number of commands to save in the history:

postgres=# \set HISTSIZE 100
postgres=# \echo :HISTSIZE
100
postgres=#


From the documentation:


HISTSIZE - The number of commands to store in the command history. The
default value is 500

You can set it in your ~/.psqlrc.

Code Snippets

postgres=# \set HISTSIZE 100
postgres=# \echo :HISTSIZE
100
postgres=#

Context

StackExchange Database Administrators Q#148968, answer score: 5

Revisions (0)

No revisions yet.