Re: Terribly slow query with very good plan?

From: Les <nagylzs(at)gmail(dot)com>
To: Nick Cleaton <nick(at)cleaton(dot)net>
Cc: pgsql-performance(at)lists(dot)postgresql(dot)org
Subject: Re: Terribly slow query with very good plan?
Date: 2022-02-04 13:21:51
Message-ID: CAKXe9UB0M=O3SJcwMU_FE-6xM_pBpPeCWXeL4S7y3yTN7+MqUw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

> >
> > 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;
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
|

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Ninad Shah 2022-02-04 13:33:16 Re: Terribly slow query with very good plan?
Previous Message Nick Cleaton 2022-02-04 13:19:04 Re: Terribly slow query with very good plan?