When working with a large number of elements in an Array, PostgreSQL uses a bitmap heap scan. To leverage the primary key index instead, provide the values directly rather than using an Array.
For more information read this article:https://www.datadoghq.com/blog/100x-faster-postgres-performance-by-changing-1-line/