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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T12:53:20+00:00 2026-06-09T12:53:20+00:00

The following query runs very slow when running the sql against a SQL Server

  • 0

The following query runs very slow when running the sql against a SQL Server CE database, I had hoped to translate it to linq for EF. Can anyone advise on this, I haven’t created any indexes on SQL Server CE yet. Table2 has 100,000 rows.

SELECT 
    *
FROM
    Table1 T1a
WHERE
    EXISTS
(
SELECT
    NULL
FROM
    Table2 T2
        JOIN Table1 T1b ON T2.Field1 = T2.Field1
WHERE
    T2.SomeID = 12345 AND
    T1a.SomeString = T1b.SomeString
)
ORDER BY
    T1a.SomeString,
    T1a.AnotherString
  • 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-09T12:53:22+00:00Added an answer on June 9, 2026 at 12:53 pm

    Considering ONLY the information given.

    To me T2.SomeID would be the most obvious place to start with an index. After that you might look at T2.Field1 because of it’s use in the join (and possibly T1.Field1 depending on the # of rows in T1). The next one is likely going to be T1.SomeString both for it’s comparison usage and because it’s being used in a sort.

    Other than T2.SomeID however it kind of depends on the makeup of your data, the cardinality of each value, how many rows are in the tables, how many other queries there are. How many updates vs lookups will be done etc. etc. etc.

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

Sidebar

Related Questions

i have the following SQL Query which runs on SQL Server CE 4 SELECT
I'm running the following query on my database, which generates a sql query I
I have the following query which runs fine on all of my sql server
I have the following query that runs in my Oracle database and I want
I'm running sql analyzer on the following query SELECT bl.Invoice_Number, bl.Date_Invoice, ti.TranNo, bt.Description, CONVERT(decimal(15,2),
I have the following query which runs perfectly well on both Oracle and SQL
I have the following SQL query that runs fairly well, however it seems to
I have the following query that runs successfully in LinqPad: var results = from
I have the following query that when executed, it just runs for hours and
I have the following SQL query in MS Access. I'm trying to order the

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.