Re: Django Query optimizing performance (HUGE DATA)

2020-07-24 Thread Sci Mithilesh
WhatsApp number +918709440658

On Sun, 19 Jul 2020, 11:33 pm chinna,  wrote:

> Thank you Vishnu
>
>
> On Sun, Jul 19, 2020 at 7:16 AM Vishnu Thuletiya <
> vishnuthulet...@gmail.com> wrote:
>
>> I think you can use 'select_related(name of foreign key class) ' insted
>> of all().
>>
>> On Sun, 19 Jul 2020, 9:11 am karthik challa, 
>> wrote:
>>
>>> 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)
>>>  full_url = models.CharField(max_length=1000, unique=True, db_index=True
>>> )
>>>  class Meta:
>>>  ordering = ['full_url']
>>>
>>>  def __str__(self):
>>>  return self.full_url
>>>
>>> 1>Django query ORM
>>>
>>> subdomains = Subdomain.objects.all().annotate(numItems=Count(
>>> 'url_subdomain')).order_by('name')
>>>
>>> 2>SQL Query
>>>
>>> SELECT "urls_subdomain"."id", "urls_subdomain"."created_at",
>>> "urls_subdomain"."name", COUNT("urls_url"."id") AS "numItems"
>>>  FROM "urls_subdomain" LEFT OUTER
>>> JOIN "urls_url" ON ("urls_subdomain"."id" = "urls_url"."subdomain_id")
>>> GROUP BY "urls_subdomain"."id" ORDER BY "urls_subdomain"."name" ASC
>>>
>>> 3>Templates
>>>
>>> {% if subdomains %}
>>>  
>>>  Subdomain
>>>  
>>>  {% for item in subdomains %}
>>>  item
>>>  {% endfor %}
>>>  
>>>  
>>>
>>>  {% endif %}
>>>
>>> Please let me know how can i optimize the preformance Thanks & Regards,
>>> Karthik
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django developers (Contributions to Django itself)" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-developers+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-developers/996db826-fe18-4557-977b-58493c1f9481o%40googlegroups.com
>>> 
>>> .
>>>
>> --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "Django developers (Contributions to Django itself)" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/django-developers/tEIXmhCXXO4/unsubscribe
>> .
>> To unsubscribe from this group and all its topics, send an email to
>> django-developers+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-developers/CACggCHuGf%2BwUA4pYcB9%2BfDt3XLpVsjqQaw%3DyoL6WrfcwKp%2B5bA%40mail.gmail.com
>> 
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django developers (Contributions to Django itself)" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-developers+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-developers/CAH6_U_ainAUaw2AXWmzA%2BEdDEY%2B-AHOPbO1LXnHOX168DnUrdQ%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/CAJP%3DbzAPwmoK04GC0kypGO9yis7j5ZWAGLePzBMZ2SZpe9GWPg%40mail.gmail.com.


Re: Query Optimization (Huge Data in the Database)

2020-07-26 Thread Sci Mithilesh
call or replay me I am interested +918709440658

On Sun, 19 Jul 2020, 9:11 am karthik challa, 
wrote:

> Hi Experts,
>
> I am trying to execute a Django query (ORM) but my query is taking more
> than  4 mins as the table have huge records.
>
> Here are the details
>
> 1> I am using left outer join to get count from other table
>
> 2>Django query
> subject = Table1.objects.all().annotate(numItems=Count('table2.field')).
> order_by('name')
>
>
>
> 3>Here I am converting the above query set to Raw sql
> SELECT "table1"."id", "table1"."created_at", "table1"."name", COUNT(
> "table2"."id") AS "numItems"  FROM
> "table1" LEFT OUTER JOIN "table2" ON ("table1"."id" = "table2".
> "subdomain_id") GROUP BY "table1"."id" ORDER BY "table1"."name" ASC
>
> and I am returning response to template index.html
>
> response = render(request, 'search_home.html', context)
>
>
> My template looks like this
> {% if context.subject %}
> {% for item in context.subject %}
> {{ item }}
> {% endfor %}
> {% endif %}
> Please  let me know how can i reduce the performance time or how can i
> optimize the query .
>
> Thanks & Regards,
> Karthik
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django developers (Contributions to Django itself)" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-developers+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-developers/ab90edb2-7d5e-4e01-9fad-0c71cb916a67o%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/CAJP%3DbzCehTLi3znPp%2Bv1zKPJ20VbhbNJS2nEHox%2BPKjMTrhLkA%40mail.gmail.com.


Re: Making startproject's settings more 12-factor-y

2020-07-26 Thread Sci Mithilesh
ok whatsapp +918709440658

On Fri, 10 Jul 2020, 2:54 pm '1337 Shadow Hacker' via Django developers
(Contributions to Django itself), 
wrote:

> All right, thank you for your feedback.
>
> May I throw in the idea of using DJ_ instead of DJANGO_ as prefix ?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django developers  (Contributions to Django itself)" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-developers+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-developers/PBiCVsKC2UAJFHuD-tEkUh2063D7DgV1DcAxdlcFI2tSqpPxK-8XVWSPbSnyvG5spVf_1QYHZeyNN2dimPNPk7NrS0eh9zq-PhAQxSHAsMk%3D%40protonmail.com
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/CAJP%3DbzAUtXSLRRtDOx%2BBRPe%3Dt7f9s%3DXc%2BUP1Y1OCJmz1GsT7Jg%40mail.gmail.com.


Re: Rethink (?) how we handle security headers.

2020-07-30 Thread Sci Mithilesh
Your contact number send me I want a VIP site

On Thu, 30 Jul 2020, 2:37 pm Carlton Gibson, 
wrote:

> Hi.
>
> (This is quite preliminary but...)
>
> So we added support for Referrer-Policy in 3.0
> https://docs.djangoproject.com/en/3.0/ref/middleware/#referrer-policy
>
> This added the SECURE_REFERRER_POLICY setting.
>
> We have a Someday/Maybe Permissions-Policy (was Feature-Policy).
> for https://code.djangoproject.com/ticket/30746
>
> Then a proposal for a new one Cross-Origin Opener Policy
> https://code.djangoproject.com/ticket/31840
>
> > This can be implemented in a similar way to the Referrer-Policy header
> in the security middleware.
>
> But are we going to continue to add settings along this line, one for
> every new header that comes up?
>
> Maybe, but I feel like we might need to review how we handle such things.
>
>
> One thought that has come up (here and elsewhere) is that it would be good
> if Middleware could be configured with parameters without having to
> subclass. I wonder if (I suspect) that has come up as an idea before?
>
>
> Otherwise does anyone have thoughts on this issue? (Maybe we can just keep
> adding settings — we have a lot for *_COOKIE_* for example.)
>
>
> Thanks,
> Carlton
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django developers (Contributions to Django itself)" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-developers+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-developers/f35d51f3-83d2-4ace-a288-daef7c31abe4o%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/CAJP%3DbzAF4%2Bsty9iRRBo3DabH9ZMGKf38-hnGzMZ4cJjry6OZtA%40mail.gmail.com.