0

When using a local database (running in docker, through Laraval Sail), database queries in my Laravel/React application are always done in a fraction of a second. Yet when connecting to a postgresql db on digitalocean, the first query on a page often takes ~5 seconds.

When connecting to the remote database through a database explorer (dbeaver) everything is really fast, both connecting and doing queries are always done in milliseconds.

What could cause this, and how would I go about debugging this? It seems something is being done that always fails, and after a 5 second timeout the Laravel application decides to take a different approach.

screenshot of laravel debugbar showing slow database query

Plumpie
  • 426
  • 1
  • 6
  • 22

1 Answers1

-1

For the sake of completeness if somebody misses the comment:

There is a known issue in Postgress when using localhost instead of 127.0.0.1. So use 127.0.0.1 to fix your issue. More details can be found here.

online Thomas
  • 8,864
  • 6
  • 44
  • 85