From: | Jeff Janes <jeff(dot)janes(at)gmail(dot)com> |
---|---|
To: | Shaheed Haque <shaheedhaque(at)gmail(dot)com> |
Cc: | pgsql-general <pgsql-general(at)lists(dot)postgresql(dot)org> |
Subject: | Re: JSONB index not in use, but is TOAST the real cause of slow query? |
Date: | 2022-05-30 19:29:31 |
Message-ID: | CAMkU=1yuOCa8R8fw6hE0JbnRY8RWr+aKGre6UvaPBV0k6Mi=fg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Sat, May 28, 2022 at 1:54 PM Shaheed Haque <shaheedhaque(at)gmail(dot)com>
wrote:
>
And how can I understand the dreadful amount of
> time (of course, this is just on my dev machine, but still...)? Is
> there a way to see/tweak what TOAST costs or indeed to confirm if it
> is even in use?
>
Turn on track_io_timing, and then do explain (analyse, buffers). This
won't distinguish TOAST from main table IO, but will at least confirm if a
large amount of IO is happening and how long it is taking.
You can look at pg_statio_user_tables before the after the query to
distinguish TOAST, but this won't give you the timing, just the block
counts. And the counts might also get incremented by concurrent users, so
on a busy system it is hard to interpret.
Are these queries fast upon repeat execution? A few meg time less than
1000 it just not that much with modern hardware, you should be able to just
cache it in RAM.
Cheers,
Jeff
From | Date | Subject | |
---|---|---|---|
Next Message | Jeff Janes | 2022-05-30 22:16:52 | Re: autovacuum on primary blocking queries on replica? |
Previous Message | Shaheed Haque | 2022-05-30 18:59:54 | Re: Is it possible to index "deep" into a JSONB column? |