From: | Jeff Janes <jeff(dot)janes(at)gmail(dot)com> |
---|---|
To: | Phani Prathyush Somayajula <phani(dot)somayajula(at)pragmaticplay(dot)com> |
Cc: | "pgsql-admin(at)lists(dot)postgresql(dot)org" <pgsql-admin(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Partition By Range Without PrimaryKey : Postgresql Version 12.8 on AWS RDS |
Date: | 2023-05-22 19:40:47 |
Message-ID: | CAMkU=1wdRdbLqW+fBR249ksB4p9_v5iqtkC_qqp6+4TbWgjCzQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-admin |
On Mon, May 22, 2023 at 2:54 AM Phani Prathyush Somayajula <
phani(dot)somayajula(at)pragmaticplay(dot)com> wrote:
> Hi All,
>
>
>
> I’ve a table ermabet having 80mil records. My business need is to check
> the bet placed by a player(users), which queries the table, and enable
> streaming for the player only if he has placed his bet in the last 24 hrs(
> granular to the millisecond).
>
> I can’t create a partition by range(date) and the query is taking more
> than 5 mins, whereas we’re expecting the query to run less than 300ms.
>
This is confusing. Is your main question about performance, or about
designing a primary key, or about designing partitioning? They are pretty
different things. If you fix the performance problem the right way, do you
need partitioning at all? An 80 million row table is not all that large, I
would normally not think partitioning it would be very important.
-- Step 3: Create indexes on child tables
>
> CREATE INDEX ermabet_bstatus_idx ON bets.ermabet_2022 USING btree
> (betstatus);
>
>
>
If you create indexes on the parent table, they will automatically be
created on each child. Only if you want different children to have
different indexes should you create them separately on the children.
Based on your plan shared in a different email, you need an index on
(brandid, playerid, placedon). With the right index, I doubt partitioning
would be needed.
Cheers,
Jeff
>
From | Date | Subject | |
---|---|---|---|
Next Message | kaido vaikla | 2023-05-23 07:35:34 | Re: pg_stat_activity query_id |
Previous Message | Jeff Janes | 2023-05-22 19:07:11 | Re: RDS No free space |