Config
The cfg
module contains a set of types and scalars used for configuring
EdgeDB.
Type |
Description |
The abstract base type for all configuration objects. The properties of this type define the set of configuruation settings supported by EdgeDB. | |
The main configuration object. The properties of this object reflect the overall configuration setting from instance level all the way to session level. | |
The database configuration object. It reflects all the applicable configuration at the EdgeDB database level. | |
The database branch configuration object. It reflects all the applicable configuration at the EdgeDB branch level. | |
The instance configuration object. | |
The abstract base type for all extension configuration objects. Each extension can define the necessary configuration settings by extending this type and adding the extension-specific properties. | |
An object type representing an authentication profile. | |
An enum type representing the different protocols that EdgeDB speaks. | |
An abstract object type representing a method of authentication | |
A subclass of AuthMethod indicating an “always trust” policy (no authentication). | |
A subclass of AuthMethod indicating password-based authentication. | |
A subclass of AuthMethod indicating basic password-based authentication. | |
A subclass of AuthMethod indicating token-based authentication. | |
A scalar type for storing a quantity of memory storage. |
Available Configuration Parameters
Connection settings
- listen_addresses -> multi str
-
Specifies the TCP/IP address(es) on which the server is to listen for connections from client applications. If the list is empty, the server does not listen on any IP interface at all.
- listen_port -> int16
-
The TCP port the server listens on;
5656
by default. Note that the same port number is used for all IP addresses the server listens on.
Resource usage
- effective_io_concurrency -> int64
-
Sets the number of concurrent disk I/O operations that can be executed simultaneously. Corresponds to the PostgreSQL configuration parameter of the same name.
- query_work_mem -> cfg::memory
-
The amount of memory used by internal query operations such as sorting. Corresponds to the PostgreSQL
work_mem
configuration parameter. - shared_buffers -> cfg::memory
-
The amount of memory the database uses for shared memory buffers. Corresponds to the PostgreSQL configuration parameter of the same name. Changing this value requires server restart.
Query planning
- default_statistics_target -> int64
-
Sets the default data statistics target for the planner. Corresponds to the PostgreSQL configuration parameter of the same name.
- effective_cache_size -> cfg::memory
-
Sets the planner’s assumption about the effective size of the disk cache that is available to a single query. Corresponds to the PostgreSQL configuration parameter of the same name.
Query cacheNew
- auto_rebuild_query_cache -> bool
-
Determines whether to recompile the existing query cache to SQL any time DDL is executed.
- query_cache_mode -> cfg::QueryCacheMode
-
Allows the developer to set where the query cache is stored. Possible values:
-
cfg::QueryCacheMode.InMemory
- All query cache is lost on server restart. This mirrors pre-5.0 EdgeDB’s behavior. -
cfg::QueryCacheMode.RegInline
- The in-memory query cache is also stored in the database as-is so it can be restored on restart. -
cfg::QueryCacheMode.Default
- Allow the server to select the best caching option. Currently, it will selectInMemory
for arm64 Linux andRegInline
for everything else.
-
Query behavior
- allow_bare_ddl -> cfg::AllowBareDDL
-
Allows for running bare DDL outside a migration. Possible values are
cfg::AllowBareDDL.AlwaysAllow
andcfg::AllowBareDDL.NeverAllow
.When you create an instance, this is set to
cfg::AllowBareDDL.AlwaysAllow
until you run a migration. At that point it is set tocfg::AllowBareDDL.NeverAllow
because it’s generally a bad idea to mix migrations with bare DDL.
- apply_access_policies -> bool
-
Determines whether access policies should be applied when running queries. Setting this to
false
effectively puts you into super-user mode, ignoring any access policies that might otherwise limit you on the instance.This setting can also be conveniently accessed via the “Config” dropdown menu at the top of the EdgeDB UI (accessible by running the CLI command
edgedb ui
from within a project). The setting will apply only to your UI session, so you won’t have to remember to re-enable it when you’re done. - apply_access_policies_sql -> bool
-
Determines whether access policies should be applied when running queries over SQL adapter. Defaults to
false
. - force_database_error -> str
-
A hook to force all queries to produce an error. Defaults to ‘false’.
This parameter takes a
str
instead of abool
to allow more verbose messages when all queries are forced to fail. The database will attempt to deserialize thisstr
into a JSON object that must include atype
(which must be an EdgeDB error type name), and may also includemessage
,hint
, anddetails
which can be set ad-hoc by the user.For example, the following is valid input:
'{ "type": "QueryError", "message": "Did not work", "hint": "Try doing something else", "details": "Indeed, something went really wrong" }'
As is this:
'{ "type": "UnknownParameterError" }'
Client connections
- allow_user_specified_id -> bool
-
Makes it possible to set the
.id
property when inserting new objects.Enabling this feature introduces some security vulnerabilities:
-
An unprivileged user can discover ids that already exist in the database by trying to insert new values and noting when there is a constraint violation on
.id
even if the user doesn’t have access to the relevant table. -
It allows re-using object ids for a different object type, which the application might not expect.
Additionally, enabling can have serious performance implications as, on an
insert
, every object type must be checked for collisions.As a result, we don’t recommend enabling this. If you need to preserve UUIDs from an external source on your objects, it’s best to create a new property to store these UUIDs. If you will need to filter on this external UUID property, you may add an index on it.
-
- session_idle_timeout -> std::duration
-
Sets the timeout for how long client connections can stay inactive before being forcefully closed by the server.
Time spent on waiting for query results doesn’t count as idling. E.g. if the session idle timeout is set to 1 minute it would be OK to run a query that takes 2 minutes to compute; to limit the query execution time use the
query_execution_timeout
setting.The default is 60 seconds. Setting it to
<duration>'0'
disables the mechanism. Setting the timeout to less than2
seconds is not recommended.Note that the actual time an idle connection can live can be up to two times longer than the specified timeout.
This is a system-level config setting.
- session_idle_transaction_timeout -> std::duration
-
Sets the timeout for how long client connections can stay inactive while in a transaction.
The default is 10 seconds. Setting it to
<duration>'0'
disables the mechanism.For
session_idle_transaction_timeout
andquery_execution_timeout
, values under 1ms are rounded down to zero, which will disable the timeout. In order to set a timeout, please set a duration of 1ms or greater.session_idle_timeout
can take values below 1ms. - query_execution_timeout -> std::duration
-
Sets a time limit on how long a query can be run.
Setting it to
<duration>'0'
disables the mechanism. The timeout isn’t enabled by default.For
session_idle_transaction_timeout
andquery_execution_timeout
, values under 1ms are rounded down to zero, which will disable the timeout. In order to set a timeout, please set a duration of 1ms or greater.session_idle_timeout
can take values below 1ms.
The main configuration object type.
This type will have only one object instance. The cfg::Config
object
represents the sum total of the current EdgeDB configuration. It reflects
the result of applying instance, branch, and session level configuration.
Examining this object is the recommended way of determining the current
configuration.
Here’s an example of checking and disabling access policies:
db>
select cfg::Config.apply_access_policies;
{true}
db>
configure session set apply_access_policies := false;
OK: CONFIGURE SESSION
db>
select cfg::Config.apply_access_policies;
{false}
The branch-level configuration object type.
This type will have only one object instance. The cfg::DatabaseConfig
object represents the state of branch and
instance-level EdgeDB configuration.
For overall configuration state please refer to the cfg::Config
instead.
As of EdgeDB 5.0, this config object represents database branch and instance-level configuration.
The branch-level configuration object type.
This type will have only one object instance. The cfg::BranchConfig
object represents the state of branch and
instance-level EdgeDB configuration.
For overall configuration state please refer to the cfg::Config
instead.
The instance-level configuration object type.
This type will have only one object instance. The cfg::InstanceConfig
object represents the state of only instance-level EdgeDB configuration.
For overall configuraiton state please refer to the cfg::Config
instead.
An abstract type representing extension configuration.
Every extension is expected to define its own extension-specific config
object type extending cfg::ExtensionConfig
. Any necessary extension
configuration setting should be represented as properties of this concrete
config type.
Up to three instances of the extension-specific config type will be created,
each of them with a required single link cfg
to the
cfg::Config
, cfg::DatabaseConfig
, or
cfg::InstanceConfig
object depending on the configuration level.
The cfg::AbstractConfig
exposes a corresponding computed
multi-backlink called extensions
.
For example, ext::pgvector extension exposes
probes
as a configurable parameter via ext::pgvector::Config
object:
db> ...
configure session
set ext::pgvector::Config::probes := 5;
OK: CONFIGURE SESSION
db>
select cfg::Config.extensions[is ext::pgvector::Config]{*};
{ ext::pgvector::Config { id: 12b5c70f-0bb8-508a-845f-ca3d41103b6f, probes: 5, ef_search: 40, }, }
An object type designed to specify a client authentication profile.
db> ...
configure instance insert
Auth {priority := 0, method := (insert Trust)};
OK: CONFIGURE INSTANCE
Below are the properties of the Auth
class.
- priority -> int64
-
The priority of the authentication rule. The lower this number, the higher the priority.
- user -> multi str
-
The name(s) of the database role(s) this rule applies to. If set to
'*'
, then it applies to all roles. - method -> cfg::AuthMethod
-
The name of the authentication method type. Expects an instance of
cfg::AuthMethod
; Valid values are:Trust
for no authentication andSCRAM
for SCRAM-SHA-256 password authentication. - comment -> optional str
-
An optional comment for the authentication rule.
Value |
Description |
cfg::ConnectionTransport.TCP |
EdgeDB binary protocol |
cfg::ConnectionTransport.TCP_PG |
Postgres protocol for the SQL query mode |
cfg::ConnectionTransport.HTTP |
EdgeDB binary protocol tunneled over HTTP |
cfg::ConnectionTransport.SIMPLE_HTTP |
EdgeQL over HTTP and GraphQL endpoints |
An abstract object class that represents an authentication method.
It currently has four concrete subclasses, each of which represent an
available authentication method: cfg::SCRAM
,
cfg::JWT
, cfg::Password
, and
cfg::Trust
.
- transports -> multi cfg::ConnectionTransport
-
Which connection transports this method applies to. The subclasses have their own defaults for this.
cfg::SCRAM
indicates password-based authentication.
It uses a challenge-response scheme to avoid transmitting the
password directly. This policy is implemented via SCRAM-SHA-256
It is available for the TCP
, TCP_PG
, and HTTP
transports
and is the default for TCP
and TCP_PG
.
db> ...
configure instance insert
Auth {priority := 0, method := (insert SCRAM)};
OK: CONFIGURE INSTANCE
cfg::Password
indicates simple password-based authentication.
Unlike cfg::SCRAM
, this policy transmits the password
over the (encrypted) channel. It is implemened using HTTP Basic
Authentication over TLS.
This policy is available only for the SIMPLE_HTTP
transport, where it is
the default.
A scalar type representing a quantity of memory storage.
As with uuid
, datetime
, and several other types, cfg::memory
values are declared by casting from an appropriately formatted string.
db>
select <cfg::memory>'1B'; # 1 byte
{<cfg::memory>'1B'}
db>
select <cfg::memory>'5KiB'; # 5 kibibytes
{<cfg::memory>'5KiB'}
db>
select <cfg::memory>'128MiB'; # 128 mebibytes
{<cfg::memory>'128MiB'}
The numerical component of the value must be a non-negative integer; the
units must be one of B|KiB|MiB|GiB|TiB|PiB
. We’re using the explicit
KiB
unit notation (1024 bytes) instead of kB
(which is ambiguous,
and may mean 1000 or 1024 bytes).