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 823317
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T02:55:50+00:00 2026-05-15T02:55:50+00:00

I am trying to optimize this query. It is not slow for now but

  • 0

I am trying to optimize this query. It is not slow for now but I am expecting a spike to hit this query in the near future. Is there anything else i can do to make this query faster?

var posts = from p in context.post
                        where p.post_isdeleted == false && p.post_parentid == null
                        select new
                        {
                            p.post_date,
                            p.post_id,
                            p.post_titleslug,
                            p.post_title,
                            p.post_descriptionrender,
                            p.userinfo.user_username,
                            p.userinfo.user_userid,
                            p.userinfo.user_GravatarHash,
                            p.userinfo.user_points,
                            p.category.catid,
                            p.category.name,
                            p.post_answercount,
                            p.post_hasbestanswer,
                            p.post_hits,
                            p.post_isanonymous,
                            p.post_votecount,
                            FavoriteCount = context.favorites.Where(x => x.post.post_id == p.post_id).Count(),
                            tags = from tg in context.posttag
                                   where tg.posttag_postid == p.post_id
                                    select new
                                    {
                                        tg.tag.tag_id,
                                        tg.tag.tag_title
                                    }
                        };
  • 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-05-15T02:55:51+00:00Added an answer on May 15, 2026 at 2:55 am

    In a general sense you could look into caching that information, but nothing is intrinsically “slow” about the query. This will really depend on how the query is being used (how often, what data is being hit, etc). There are a lot of possible optimization solutions for a given problem, and though you may find improvements based on intuition you’ll have a much easier time doing so if you have profiling tools in place to nail down problem areas. Plus, you’ll have the satisfaction of proving that the areas you improve are worth the time investment.

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

Sidebar

Related Questions

I'm trying to figure out how to optimize a very slow query in MySQL
Hey guys, trying to optimize this query to solve a duplicate user issue: SELECT
I'm trying to optimize a slow query that was generated by the Django ORM.
I'm trying to optimize this mysql query using EXPLAIN. Can somebody please help me
I am trying to optimize a bigger query and ran into this wall when
I'm trying to optimize query performance and have had to resort to using optimizer
I'm having trouble trying to optimize the following query for sql server 2005. Does
I've trying to optimize a query on MySQL that takes around 15-20 seconds to
i'm trying to get optimize an very old query that i can't wrap my
I am trying to optimize some stored procedures on a SQL Server 2000 database

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.