Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9088371
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T21:53:44+00:00 2026-06-16T21:53:44+00:00

Need a way to improve performance on my website’s SQL based Activity Feed. We

  • 0

Need a way to improve performance on my website’s SQL based Activity Feed. We are using Django on Heroku.

Right now we are using actstream, which is a Django App that implements an activity feed using Generic Foreign Keys in the Django ORM. Basically, every action has generic foreign keys to its actor and to any objects that it might be acting on, like this:

Action:
(Clay – actor) wrote a (comment – action object) on (Andrew’s review of Starbucks – target)

As we’ve scaled, its become way too slow, which is understandable because it relies on big, expensive SQL joins.

I see at least two options:

  1. Put a Redis layer on top of the SQL database and get activity feeds from there.
  2. Try to circumvent the Django ORM and do all the queries in raw SQL, which I understand can improve performance.

Any one have thoughts on either of these two, or other ideas, I’d love to hear them.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T21:53:45+00:00Added an answer on June 16, 2026 at 9:53 pm

    Went with an approach that sort of combined the two suggestions.

    We created a master list of every action in the database, which included all the information we needed about the actions, and stuck it in Redis. Given an action ID, we can now do a Redis look up on it and get a dictionary object that is ready to be returned to the front end.

    We also created action id lists that correspond to all the different types of activity streams that are available to a user. So given a user id, we have his friends’ activity, his own activity, favorite places activity, etc, available for look up. (These I guess correspond somewhat to materialized views, although they are in Redis, not in PSQL.)

    So we get a user’s feed as a list of action ids. Then we get the details of those actions by look ups on the ids in the master action list. Then we return the feed to the front end.

    Thanks for the suggestions, guys.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need a way to automatically format Date and Number objects based on locale
I'm looking for a way to improve the performance of some drawing I am
I have legacy code which I need to improve for performance reasons. My application
Is there any way to improve ScrollView performance? This is just a theoretical question
I need to improve memory performance on my application and I could see that
I'm using Django to build a website with a MySQL (MyISAM) backend. The database
I am trying to improve performance on an application using Hibernate which is executing
I need to improve the performance of a large MySQL view. Most of it
I need a way to change the specific value of a column of a
I need a way in my Chrome extension to know when the browser is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.