query (eg: SELECT * FROM students WHERE subject_id = 266 LIMIT 50)
runs fast on the primary.. but never finishes running on the read replica.
1. What could be the reason for this?
2. If it's due to replication lag or replica waiting for the wal, is there a way to make it so that query finishes fast (even if it's old data)
More context:
*. subject_ids are indexed.
*. Issue only happens with certain subject_id, while others work smoothly. This particular subject_id has 90M+ rows..
*. There are continuous inserts happening to primary.
Run EXPLAIN ANALYZE SELECT * FROM students WHERE subject_id = 266 LIMIT 50; on the read replica and check
Of course I tried it. It doesn't finish executing in a reasonable time ( waited 15+ mins) :)
Обсуждают сегодня