Update schema reloading section

Fixes https://github.com/PostgREST/postgrest-docs/issues/243
This commit is contained in:
steve-chavez
2020-04-21 15:16:21 -05:00
committed by Steve Chavez
parent 33768c509c
commit 3292fce732
+16
View File
@@ -187,12 +187,28 @@ Schema Reloading
Users are often confused by PostgREST's database schema cache. It is present because detecting foreign key relationships between tables (including how those relationships pass through views) is necessary, but costly. API requests consult the schema cache as part of :ref:`resource_embedding`. However if the schema changes while the server is running it results in a stale cache and leads to errors claiming that no relations are detected between tables.
.. important::
Since v5.0, PostgREST also makes use of the schema cache for stored functions metadata: parameters, return type, volatility.
It also uses the schema cache for resolving overloaded functions. You should refresh the cache if a change in any of the prior is done.
To refresh the cache without restarting the PostgREST server, send the server process a SIGUSR1 signal:
.. code:: bash
killall -SIGUSR1 postgrest
.. note::
To refresh the cache in docker:
.. code:: bash
docker kill -s SIGUSR1 <container>
# or in docker-compose
docker-compose kill -s SIGUSR1 <service>
The above is the manual way to do it. To automate the schema reloads, use a database trigger like this:
.. code-block:: postgresql