Conversation
| var err error | ||
|
|
||
| if config.PgDatabaseUrl != "" { | ||
| if config.PgRuntimeUrl != "" { |
There was a problem hiding this comment.
Perhaps we're the only users of data-sync, but do you think it maybe safer to fail fast if (the old) DATABASE_URL is set and DATABASE_RUNTIME_URL not set?
There was a problem hiding this comment.
That will change the semantic of which data source to use. I honestly think it is ok and it will allow us rollback fast if needed.
There was a problem hiding this comment.
My concern is more for other users of it, on update if they don't change their env config they'll switch into sqlite storage
| // pooler (e.g. Supavisor :6543), since golang-migrate needs a session. | ||
| migrationURL := config.PgMigrationUrl | ||
| if migrationURL == "" { | ||
| migrationURL = config.PgRuntimeUrl |
There was a problem hiding this comment.
Should we log a warning that the DATABASE_RUNTIME_URL will be used?
| @@ -0,0 +1 @@ | |||
| CREATE INDEX IF NOT EXISTS idx_records_user_revision ON records (user_id, revision); | |||
There was a problem hiding this comment.
Claude suggests using CREATE INDEX CONCURRENTLY as it otherwise takes exclusive access, blocking other uses of records until complete. Depends how large the table is I guess
| @@ -0,0 +1 @@ | |||
| CREATE INDEX CONCURRENTLY IF NOT EXISTS idx_records_user_revision ON records (user_id, revision); | |||
There was a problem hiding this comment.
What is the reason to change this index? I'm asking because the query performance advisor doesn't flag this as a suggestion. It does suggest these for about 5% performance gain.
CREATE INDEX ON public.records USING btree (user_id);
and
CREATE INDEX ON public.user_revisions USING btree (user_id);
Improving performance by: