mirror of
https://github.com/open-webui/open-webui.git
synced 2026-09-08 22:21:38 +00:00
fix: reduce BATCH_SIZE to avoid PG bind param limit, commit per index
This commit is contained in:
parent
116a6b8eac
commit
05ef5c5223
1 changed files with 4 additions and 2 deletions
|
|
@ -21,7 +21,9 @@ down_revision: Union[str, None] = '374d2f66af06'
|
|||
branch_labels: Union[str, Sequence[str], None] = None
|
||||
depends_on: Union[str, Sequence[str], None] = None
|
||||
|
||||
BATCH_SIZE = 5000
|
||||
# PostgreSQL has a 65,535 bind parameter limit. With 17 columns per row,
|
||||
# max safe batch is floor(65535 / 17) = 3855. Use 3000 for headroom.
|
||||
BATCH_SIZE = 3000
|
||||
CHAT_PAGE_SIZE = 100
|
||||
|
||||
|
||||
|
|
@ -405,7 +407,7 @@ def _upgrade_postgresql() -> None:
|
|||
"CREATE INDEX IF NOT EXISTS chat_message_user_created_idx ON chat_message (user_id, created_at)",
|
||||
]:
|
||||
conn.execute(sa.text(stmt))
|
||||
conn.commit()
|
||||
conn.commit() # Commit each index to avoid WAL accumulation
|
||||
log.info("Phase 3 complete: indexes created")
|
||||
|
||||
# Phase 4: Add FK constraint
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue