On Mar 5, 12:05 am, Rajesh D <rajesh.dha...@gmail.com> wrote:
> On Mar 4, 1:44 pm, Kottiyath <n.kottiy...@gmail.com> wrote:
>
> > I am now managing a web server for medium (going on high) traffic
> > site. I see that currently for each POST, it takes ~55-60 separate DB
> > queries for providing a reply.
> > Is this unusual? The total time taken for the queries is less than a
> > second.
> > I looked at the design and it looks somewhat well designed - i.e. to
> > decrease the queries, we will have to do quite a bit of nasty things.
> > Can someone give me an idea whether this amount of queries is usual?
>
> The answer is "it depends". Generally speaking, that number of queries
> would be considered high and should at least cause a developer to take
> a second look at that piece more carefully as it might be an
> indication of an architectural/design deficiency.
>
> If you can share some samples of what these queries are doing, what
> Django code causes them to execute, and what that view is actually
> supposed to do, may be people can suggest options.
>
> For example, does that view issue a lot reads from the DB for data
> that doesn't change often? If so, you could consider memcaching that
> data. Similarly, some of those read queries could benefit from adding
> relevant models to its "select_related()" call.
>
> -RD
Thank you very much for the replies.
Since I will have to get permission before sharing the query
information I will just provide an overview.
There are ~20 main tables and a lot of enumerated domains. Most of the
db queries are occuring for getting the values from the enumerated
domains.
That is why I mentioned that it is not taking too much time (~1 second
per query - is that also high? ) because the values of enumerated
domain are cached by DB.
There are not too many joins - every query will have overall 6-7 inner
joins max.
Now that you guys are suggesting that the queries are very high, I
will try out the following options
(a) memcaching (b) remove enumerated domains (c) select_related with
limit 3
Are there any other suggestions? Thank you again for the quick
replies.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---