Hi,

We have a similar type of challenge in our project. We will definitely try
indexing.

Basically we are currently doing like this.

1. Registered users can post an ad in Classifieds by uploading 4 - 6 images
per ad. All the ads are placed in one postgres db table. (classifieds table)

2. Same user opens the Classifieds page where we list all the Ads posted by
this user as well as other users. This page loading is taking a lot of time.

3. Each ad will display a thumbnail image, title of the ad, 2 line
description, price value, distance value from nearby zip code, age of the
ad, zip code

4. Since we  are calculating the distance between zip codes each Ad using a
third party API, I think page loading is taking a lot of time.
4.1. I've dumb idea here where I can add a. new table, '*nearby_ads table*'.
As soon as the ad was submitted successfully, process the ads distance and
add all the nearby ads into this table. When the classifieds page is
launched, only nearby ads will be displayed. First of all I'm not sure
whether this is a good idea because we are going to have two tables,
one is *classifieds
table* and the other one is a *nearby_ads table*.  Second of all I'm not
sure what is the limit that I can set limit on how far I could calculate
nearby ads ( like 10 miles or 30 miles or 50 miles radius).

5. Our goal is to present all the nearby ads based on the logged in user
zip code and if a visitor opens this Classifieds page, we have to capture
nearby location of the visitor and present the nearby ads.

6. Additionally registered users and visitors should be able to filter the
ads based on different zip code though both are from different location

Please let me know if you recommend any advanced packages or libraries in
Django or Python to achieve the above. Or indexing is the only option to
reduce the page loading time? I appreciate it if you can share any
recommendations and pointers.

Best Regards
~Ram

On Fri, Jan 15, 2021 at 12:51 AM Benjamin Schollnick <
bscholln...@schollnick.net> wrote:

> Also don’t forget to include Indexing.
>
> As a *general* rule, any field that you perform any query against, should
> be indexed.
> Yes, it costs a “bit” for disk space, but indexing can dramatically
> increase your query speed.
>
> - Benjamin
>
>
>
> On Jan 14, 2021, at 10:44 PM, Benny M <chibe...@outlook.com> wrote:
>
> Slow loading can be sometimes be caused by non-optimized or overly complex
> queries. Look into prefetch_related and select_related for starters.
> https://docs.djangoproject.com/en/3.1/ref/models/querysets/
>
> Django Debug Toolbar is also a great packages for examining the
> interaction between Django’s ORM and your database.
>
> Best,
> Benny
>
> On Jan 14, 2021, at 9:18 PM, Salima Begum <salim...@rohteksolutions.com>
> wrote:
>
> 
> Hi all,
>
> We are building a Web application, We have a classifieds page that is
> loading too slow. How to fix this issue. how to reduce loading time of
> classifieds page.
>
> Thanks
> ~Salima
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAMSz6bnvP51oD_dfhY0YEWiGHGq3DbZ04u%2Bz6Vg_9sBPGvjgOw%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAMSz6bnvP51oD_dfhY0YEWiGHGq3DbZ04u%2Bz6Vg_9sBPGvjgOw%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CH2PR14MB391358D987FFC8303F087CD5C0A70%40CH2PR14MB3913.namprd14.prod.outlook.com
> <https://groups.google.com/d/msgid/django-users/CH2PR14MB391358D987FFC8303F087CD5C0A70%40CH2PR14MB3913.namprd14.prod.outlook.com?utm_medium=email&utm_source=footer>
> .
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/0B38486A-1A58-4FFF-A7FE-52FAB24099B6%40schollnick.net
> <https://groups.google.com/d/msgid/django-users/0B38486A-1A58-4FFF-A7FE-52FAB24099B6%40schollnick.net?utm_medium=email&utm_source=footer>
> .
>

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

Reply via email to