Skip to content

Commit 4955c26

Browse files
authored
Add query to find deferred indexes (#9)
1 parent 05d0597 commit 4955c26

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

useful_commands/index_maintenance.md

+12-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Index Maintenance
2-
Partially based on [wiki](https://wiki.postgresql.org/wiki/Index_Maintenance) and [this video](https://youtu.be/aaecM4wKdhY)
2+
3+
Partially based on [wiki](https://wiki.postgresql.org/wiki/Index_Maintenance) and [this video](https://www.youtube.com/watch?v=aaecM4wKdhY)
34

45
## Index summary
56
```sql
@@ -289,3 +290,13 @@ where contype = 'f' and
289290
group by c.conrelid, c.conname, c.oid
290291
order by (c.conrelid::regclass)::text, columns;
291292
```
293+
294+
### Deferred indexes (indexes that are created but cannot be used due to the presence of long transactions)
295+
296+
More info [here](https://youtu.be/pTWfjyeQ5Ks?si=tHYFAw5DB6dU0VLX&t=1955)
297+
298+
```sql
299+
select indexrelid::regclass as index_name, indcheckxmin
300+
from pg_index
301+
where indcheckxmin = true;
302+
```

0 commit comments

Comments
 (0)