PostgreSQL Django Query

22 views
Skip to first unread message

Sachin Kumar

unread,
Jan 7, 2021, 9:13:23 AM1/7/21
to Django users
I am using Python Django and PostgreSQL to build our report app.

I am using below mention query to find some details. the query mention below is running fine in PostgreSQL command line and giving result in 2 sc for 2 million cards but when i i am try the same in Django application it is taking too much of time and the web page is expired while running this query.

can anyone help how to make query faster in Django

rows = M_Assign.objects.raw(''' select C.id,M."merchant_name",C."MERCHANT_ID",S."store_id" Owning_Store_ID ,S."store_name" Owning_Store_Name,F."franchisee_name" Owning_Group,C."ACCOUNT_NUMBER",C."STORE_ID",C."GIFT_LIST_REF" FROM vdaccount_card_assign C INNER JOIN vd_merchant_master M ON C."MERCHANT_ID"=M."merchant_id" AND C."MERCHANT_ID"='003561002966107' INNER JOIN vd_store_master S ON S."store_id"=C."GIFT_LIST_REF" OR C."GIFT_LIST_REF"='' INNER JOIN vd_franchisee F ON S."franchisee_id"=F."franchisee_id" ''')  

gabriela...@gmail.com

unread,
Jan 7, 2021, 9:58:27 AM1/7/21
to Django users
Sachin:
I don't understand the reason you bring 2 million records. Why you don't do that witht REACT? So there is not recharge the browser every time request data from server.

Reply all
Reply to author
Forward
0 new messages