folio=# explain (analyze, buffers) SELECT supertenant_mod_circulation_storage.count_estimate_smart('SELECT * FROM supertenant_mod_circulation_storage.au dit_loan WHERE lower(f_unaccent(audit_loan.jsonb->>''id'')) ~ lower(f_unaccent(''(^|[[:punct:]]|[[:space:]]|(?=[[:punct:]]|[[:space:]]))2c40bca2-0dc5-47 3f-b258-7164f8ed2560($|[[:punct:]]|[[:space:]]|(?<=[[:punct:]]|[[:space:]]))'')) ') AS count, * FROM supertenant_mod_circulation_storage.audit_loan W HERE lower(f_unaccent(audit_loan.jsonb->>'id')) ~ lower(f_unaccent('(^|[[:punct:]]|[[:space:]]|(?=[[:punct:]]|[[:space:]]))2c40bca2-0dc5-473f-b258-7164f8 ed2560($|[[:punct:]]|[[:space:]]|(?<=[[:punct:]]|[[:space:]]))')) order by created_date desc; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------- Sort (cost=74978.55..74978.60 rows=21 width=616) (actual time=2882.923..2882.923 rows=1 loops=1) Sort Key: created_date DESC Sort Method: quicksort Memory: 26kB Buffers: shared hit=8773 read=9042 -> Seq Scan on audit_loan (cost=0.00..74978.09 rows=21 width=616) (actual time=1743.243..2882.906 rows=1 loops=1) Filter: (lower(f_unaccent((jsonb ->> 'id'::text))) ~ '(^|[[:punct:]]|[[:space:]]|(?=[[:punct:]]|[[:space:]]))2c40bca2-0dc5-473f-b258-7164f8ed2560 ($|[[:punct:]]|[[:space:]]|(?<=[[:punct:]]|[[:space:]]))'::text) Rows Removed by Filter: 213530 Buffers: shared hit=8770 read=9042 Planning time: 3000.532 ms Execution time: 2882.938 ms (10 rows) folio=#