Re: Invalid SQL : - Re: Query Optimization (Huge Data in the Database)

2020-07-19 Thread Roger Gammans
Hi I do appreciate what I was asking about wasn't your problem, I was looking at learning for myself etc. For those that are following this, it seems that Postgres (as does MySQL) loosens the SQL requirements. In Postgres ( https://www.postgresql.org/docs/11/sql-select.html#SQL-GROUPBY ) the

Re: Query Optimization (Huge Data in the Database)

2020-07-19 Thread karthik challa
Thank you Damanjeet On Sunday, July 19, 2020 at 3:32:02 AM UTC-4, Damanjeet Singh wrote: > > Hello , > > Prefetch_related can be helpful, see doc > > > > https://docs.djangoproject.com/en/3.0/ref/models/querysets/#prefetch-related > > Regards, > Damanjeet > > > > On Sun, 19 Jul 2020, 04:39

Re: Invalid SQL : - Re: Query Optimization (Huge Data in the Database)

2020-07-19 Thread karthik challa
Hi Roger, I have fetched this query from the Django Debug tool bar. I am using POSTGRES database and Django 2.2.3 version. I am able to fetch the records which i require but the issue is with the performance the django query set or the query which i am making. Thanks & Regards, karthik On

Invalid SQL : - Re: Query Optimization (Huge Data in the Database)

2020-07-19 Thread Roger Gammans
Hi Just a side issue I spotted here, but I'm probably missing something, so I'm seeking to understand. Is this the SQL the django query builder made? If so which database backend and django version are you using? On Sun, 2020-07-19 at 08:30 +0100, Damanjeet Singh wrote: > 2>SQL Query > >

Re: Query Optimization (Huge Data in the Database)

2020-07-19 Thread Damanjeet Singh
Hello , Prefetch_related can be helpful, see doc https://docs.djangoproject.com/en/3.0/ref/models/querysets/#prefetch-related Regards, Damanjeet On Sun, 19 Jul 2020, 04:39 karthik challa, wrote: > Hi Experts, > > I am trying to execute the below query and the query is taking more than 5 >

Query Optimization (Huge Data in the Database)

2020-07-18 Thread karthik challa
Hi Experts, I am trying to execute the below query and the query is taking more than 5 minutes. Here are the details Model.py class Url(models.Model): subdomain = models.ForeignKey(Subdomain, null=True, blank=True, related_name='url_subdomain', on_delete=models.SET_NULL,db_index=True)