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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T14:16:00+00:00 2026-05-28T14:16:00+00:00

SELECT … WHERE expr1 and expr2 or expr3 or expr4 this query executes in

  • 0
SELECT ... WHERE expr1 and expr2 or expr3 or expr4

this query executes in > 3 minutes.

SELECT ... WHERE expr1 and (expr2 or expr3 or expr4)

this terminates instantly.

I would have expected different results, not different performance. Can anybody explain why?

Background: the select left outer joins 7 tables, but they are not very large (< 10k records the biggest one). Here is the query, but I strongly advise that it’s unintelligible because it’s generated from a very old tool on a legacy system and the overall project is very difficult to work with. I am only interested in the question descrived above

  • 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-28T14:16:02+00:00Added an answer on May 28, 2026 at 2:16 pm

    The second version requires that expr1 be true for all records. If expr1 depends only on a single table, then the DBMS can “push” the predicate “down” and do that filtering before even performing the joins. (Even if it depends on multiple tables, it can at least be pushed down before some of the joins.) This potentially allows many fewer records to be examined, and much better use of indices.

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

Sidebar

Related Questions

SELECT UNNEST(ARRAY[1,2,3,4]) While executing the above query I got the error like this: ERROR:
I have this xml <entry id=1008 section=articles> <excerpt><p>&#8230; in Richtung „Aus für Tierversuche. Kosmetik-Fertigprodukte
I have a MySQL query: SELECT px.player, px.pos, px.year, px.age, px.gp, px.goals, px.assists ,
select email from mailing list This is the query i want to use if
select * from table where key='çmyk' when i run this query on table that
select homephone,lastName from DEBTOR where contains((lastName,homephone),'Smith AND 99 999 9999') The first query returns
select count(*) as count from table group by foreign_id order by count This returns
I have a form, one of the fields is a select field, with 5
SELECT * FROM Customer WHERE Name 'LIKE [a-f]%' How Can I acheive this in
SELECT User, COUNT(User) as count FROM Tests GROUP by User; This works. However, if

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.