Limit of psql_history
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.