fix: Remove non-immutable NOW() function from index predicate
PostgreSQL requires functions in index predicates to be immutable. The NOW() function is not immutable, so we simplify the index to just order by received_at DESC without the WHERE clause. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
11dbf8215c
commit
d68f0f2e08
1 changed files with 2 additions and 2 deletions
|
|
@ -27,11 +27,11 @@ defmodule Aprsme.Repo.Migrations.OptimizePacketQueries do
|
|||
WHERE device_identifier IS NOT NULL
|
||||
"""
|
||||
|
||||
# Partial index for recent packets (last 7 days) - very useful for most queries
|
||||
# Index for recent packets - using simple timestamp ordering
|
||||
# Note: We can't use NOW() in the WHERE clause as it's not immutable
|
||||
execute """
|
||||
CREATE INDEX CONCURRENTLY IF NOT EXISTS idx_packets_recent_only
|
||||
ON packets(received_at DESC)
|
||||
WHERE received_at > NOW() - INTERVAL '7 days'
|
||||
"""
|
||||
|
||||
# Index for weather packet lookups by callsign
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue