Does Yugabyte support initialization scripts?

Does Yugabyte supports something like /docker-entrypoint-initdb.d in PostgreSQL for initialization scripts when the container starts?

I found a related conversation in Sept 2019 at Slack .

Seems not supported at that moment.

If support today, is there any document? Thanks! :smiley:

Hongbo –
Currently we do not expose any explicit mechanism for using initdb. Our method for initialization is quite different at the moment, since an initdb as PostgreSQL does it is very expensive operation.
If you are looking to add custom functions/data types, there are other methods like setting which extensions to load as well as modifying the database creation template to automatically register certain items.
As far as initializing with a fully created database with all the objects created, it is actually much faster to use a database snapshot. For more information, see the following link: Snapshot and restore data for YSQL | YugabyteDB Docs

Hope this helps.

1 Like