You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Be sure the size your pooled datasource connections according to your application needs.
157
136
The non-pooled datasource used for monitoring appends with the NOTIFY/LISTEN mechanism only needs 2 connections.
158
137
159
-
The EventStore automatically detects the configuration style and creates appropriate DataSources.
138
+
leakDetectionThreshold on the pooled (application) connections should be set quite low, for the monitoring connections this should be at least 30 seconds, as the monitoring connection only refreshes after a longer LISTEN for updates.
160
139
161
140
## Preparing the Database Schema Manually via DDL
162
141
@@ -171,18 +150,34 @@ The recommended approach is to create the database schema manually using DDL scr
171
150
The library includes an `quickstart.ddl.sql` script (available in the JAR or source repository):
172
151
173
152
```sql
174
-
175
153
CREATETABLEevents (
154
+
-- Primary key and positioning
176
155
event_position BIGSERIALPRIMARY KEY,
156
+
157
+
-- XID8 transaction id
158
+
event_tx xid8 DEFAULT pg_current_xact_id()::xid8 NOT NULL,
159
+
160
+
-- Event identification
177
161
event_id UUID NOT NULL UNIQUE,
162
+
163
+
-- Stream identification
178
164
stream_context TEXTNOT NULL,
179
165
stream_purpose TEXTNOT NULL DEFAULT '',
166
+
167
+
-- Event metadata
180
168
event_type TEXTNOT NULL,
169
+
170
+
-- Transaction information
181
171
event_timestamp TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
172
+
173
+
-- Event payload
182
174
event_data JSONB NOT NULL,
183
175
event_erasable_data JSONB,
176
+
177
+
-- Tags as string array
184
178
event_tags TEXT[] DEFAULT '{}'
185
-
);
179
+
180
+
) WITH (FILLFACTOR =100);
186
181
187
182
-- Additional indexes, functions, and triggers...
188
183
```
@@ -201,18 +196,34 @@ For these scenario's, EventStore supports the usage of prefixes, in which all re
201
196
You can find a DDL script named `initialisation.sql`, which has exactly the same content as `quickstart.ddl.sql`, but with a "PREFIX_" before each object that you can replace by any tenant name you like, ending with "_":
202
197
203
198
```sql
204
-
205
199
CREATETABLEPREFIX_events (
200
+
-- Primary key and positioning
206
201
event_position BIGSERIALPRIMARY KEY,
202
+
203
+
-- XID8 transaction id
204
+
event_tx xid8 DEFAULT pg_current_xact_id()::xid8 NOT NULL,
205
+
206
+
-- Event identification
207
207
event_id UUID NOT NULL UNIQUE,
208
+
209
+
-- Stream identification
208
210
stream_context TEXTNOT NULL,
209
211
stream_purpose TEXTNOT NULL DEFAULT '',
212
+
213
+
-- Event metadata
210
214
event_type TEXTNOT NULL,
215
+
216
+
-- Transaction information
211
217
event_timestamp TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
0 commit comments