Danny Shemesh <dany...@gmail.com> writes:
>                                         ->  Index Only Scan using
> idx_hashes on refs  (cost=0.56..722735.47 rows=33715 width=16) (actual
> time=1727.208..1727.208 rows=1 loops=1)
>                                               Index Cond: (tid =
> '13371337-1337-1337-1337-133713371337'::uuid)
> *                                              Filter: (tidh = ANY
> ('{13391339-1339-1339-1339-133913391339}'::uuid[]))    <<<<<<<<<<<<<<<-
> Note this line*                                              Rows Removed
> by Filter: 109087
>                                               Heap Fetches: 16976
>                                               Buffers: shared hit=13051
> read=14561
>                                               I/O Timings: read=53405.294

This doesn't match up terribly well with the table definition
you showed before, but I wonder whether tidh is a low-order
index column.  If you need to optimize this specific shape
of query you need to pay attention to the index column order, per

https://www.postgresql.org/docs/current/indexes-multicolumn.html

That is, tid and tidh need to be the first two index columns.

                        regards, tom lane


Reply via email to