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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T11:07:30+00:00 2026-05-20T11:07:30+00:00

I am writing a SQL query which gives me a slow performance. Because of

  • 0

I am writing a SQL query which gives me a slow performance. Because of that it gives me 504 gateway timeout problem. Please help me to remake this query so that my output results faster. I will put the query below.

select 
  r.c1,
  parent_item.c2,
  parent_item.c3,
  parent_item.c4,
  parent_item.c5,
  parent_item.c6,
  parent_item.c7,
  pt.c8,
  child_item.c9,
  t.c10,
  child_item.c11,
from
  table1 child_item,
  table2 t,
  table3 r,
  table1 parent_item,
  table4 pt
where
  r.col1 = child_item.id and
  t.id=child_item.typeid and
  parent_item.id = r.parent_itemid and
  pt.id = parent_item.typeid  and parent_item.id=800 and 
  parent_item.id = (select
                      itemid
                    from
                      table5
                    where
                      itemid=parent_item.id  
                     ((10!= 1) ?  and (holder_itemid in (10,100) and level > 0): "")) and
  child_item.id = (select
                     itemid
                   from
                     table5
                   where
                     itemid=child_item.id  
                     ((10 != 1) ?  and (holder_itemid in (10,100) and level > 0) : ""))
order by
  r.parent_itemid,
  r.relation_typeid,
  r.ordinal
  • 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-20T11:07:30+00:00Added an answer on May 20, 2026 at 11:07 am

    It’s likely the two sub-queries, but we don’t have enough information about your schema.

    You should run your query though EXPLAIN and see what it says.

    JOINs might help, but again, we can’t tell for sure.

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

Sidebar

Related Questions

I'm writing a SQL query in SQL Server in which I need to replace
I'm writing an SQL Query, where a few of the columns returned need to
I am writing a query in SQL server2005. This is returning me a duplicate
I know several ways of writing paged query in SQL Server 2005. But I
I always have this notion that writing SQL queries in the code behind is
When writing a T-SQL script that I plan on re-running, often times I use
I'm writing SQL (for Oracle) like: INSERT INTO Schema1.tableA SELECT * FROM Schema2.tableA; where
When writing manual SQL its pretty easy to estimate the size and shape of
I've been successful with writing my own SQL access code with a combination of
I have a business user who tried his hand at writing his own SQL

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.