>
> It does not help.
What if you try applying the C collation to the values from the table:
where fi.is_active and fi.relpath collate "C" ^@ 'A'
Slow
EXPLAIN (ANALYZE, COSTS, VERBOSE, BUFFERS)
select fi.id from media.oo_file fi
where fi.is_active and fi.relpath collate "C" ^@ 'A' limit 1;
select fi.id from media.oo_file fi
where fi.is_active and fi.relpath collate "C" ^@ 'A' limit 1;
QUERY PLAN |
--------------------------------------------------------------------------------------------------------------------------+
Limit (cost=0.00..1904.09 rows=1 width=8) (actual time=3837.338..3837.340 rows=0 loops=1) |
Output: id |
Buffers: shared hit=9355 read=121908 |
-> Seq Scan on media.oo_file fi (cost=0.00..144710.65 rows=76 width=8) (actual time=3837.336..3837.336 rows=0 loops=1)|
Output: id |
Filter: (fi.is_active AND ((fi.relpath)::text ^@ 'A'::text)) |
Rows Removed by Filter: 1075812 |
Buffers: shared hit=9355 read=121908 |
Planning Time: 0.391 ms |
Execution Time: 3837.364 ms |
--------------------------------------------------------------------------------------------------------------------------+
Limit (cost=0.00..1904.09 rows=1 width=8) (actual time=3837.338..3837.340 rows=0 loops=1) |
Output: id |
Buffers: shared hit=9355 read=121908 |
-> Seq Scan on media.oo_file fi (cost=0.00..144710.65 rows=76 width=8) (actual time=3837.336..3837.336 rows=0 loops=1)|
Output: id |
Filter: (fi.is_active AND ((fi.relpath)::text ^@ 'A'::text)) |
Rows Removed by Filter: 1075812 |
Buffers: shared hit=9355 read=121908 |
Planning Time: 0.391 ms |
Execution Time: 3837.364 ms |