From: | Philip Semanchuk <philip(at)americanefficient(dot)com> |
---|---|
To: | Sachin Kumar <sachinkumaras(at)gmail(dot)com> |
Cc: | pgsql-sql(at)lists(dot)postgresql(dot)org |
Subject: | Re: how to make query |
Date: | 2021-01-07 13:58:56 |
Message-ID: | B554173E-8FCB-480D-8684-8FB60F018B28@americanefficient.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
> On Jan 7, 2021, at 5:15 AM, Sachin Kumar <sachinkumaras(at)gmail(dot)com> wrote:
>
> Hi Team,
>
> we are using Python Django and Postgresql. Our requirement is to search 10 Million Card data and bring specific records as a result after checking the record every time.
>
> We have to find data from a 2nd table that is related to the first one which we are checking using the loop.
>
> For Ex:-
> 10000 data - loop 10000 times
> to find data from the 2nd table.
>
> This makes our query too slower and it gets time out.
Hi Sachin,
I’m not sure based on your description, but it sounds like you need to tell Django to select related objects all in one query rather than one at a time. If that’s the case, then your problem is a Django issue, not a Postgres one. Check out select_related() --
Cheers
Philip
From | Date | Subject | |
---|---|---|---|
Next Message | Sachin Kumar | 2021-01-07 14:25:14 | Re: how to make query |
Previous Message | Sachin Kumar | 2021-01-07 11:55:42 | PostgreSQL Django Query |