QUERY 1: explain select count(*) from activities_bit_old where id > 0; (id column data-type is int4) Finalize Aggregate (cost=75709053.22..75709053.23 rows=1 width=8) -> Gather (cost=75709053.00..75709053.21 rows=2 width=8) Workers Planned: 2 -> Partial Aggregate (cost=75708053.00..75708053.01 rows=1 width=8) -> Parallel Index Only Scan using activities_bit_pkey on activities_bit_old (cost=0.58..73513797.33 rows=877702270 width=0) Index Cond: (id > 0)
QUERY 2: explain select count(*) from activities_bit where id > 0; (id column data-type is int8) Finalize Aggregate (cost=117811065.69..117811065.70 rows=1 width=8) -> Gather (cost=117811065.48..117811065.69 rows=2 width=8) Workers Planned: 2 -> Partial Aggregate (cost=117810065.48..117810065.49 rows=1 width=8) -> Parallel Index Only Scan using activities_bit_copy_pkey on activities_bit (cost=0.58..115695086.65 rows=845991530 width=0) Index Cond: (id > 0)
Above mentioned is the query plan for Table 1 and Table 2;
On Thu, Sep 5, 2024 at 7:11 PM Tomas Vondra <tomas@vondra.me> wrote:
On 9/5/24 10:11, Aditya Singh wrote: > The query on the first table didn't hit the wait event; it hit on the > second table. I can show you the same on RDS Database Insights. Both > tables have the same *Indexes*, *Data*, and *Columns*. There is only a > difference in the ID datatype. Is there any possibility of scheduling a > call to troubleshoot this issue since it is happening in the Production > environment? >
As this is a RDS database, you should probably talk to AWS support?
Other than that, share the explain plans for the two queries (as I asked in my previous response).
BTW please don't top post. It's customary to reply inline on this list.
regards
-- Tomas Vondra
Confidentiality Warning: This message and any attachments are intended only for the use of the intended recipient(s), are confidential, and may be privileged. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or other use of this message and any attachments is strictly prohibited. If received in error, please notify the sender immediately and permanently delete it.