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

  • Home
  • SEARCH
  • 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 996261
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T06:50:59+00:00 2026-05-16T06:50:59+00:00

Assume a table named ‘log’, there are huge records in it. The application usually

  • 0

Assume a table named ‘log’, there are huge records in it.

The application usually retrieves data by simple SQL:

SELECT * 
FROM log 
WHERE logLevel=2 AND (creationData BETWEEN ? AND ?)

logLevel and creationData have indexes, but the number of records makes it take longer to retrieve data.

How do we fix this?

  • 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-16T06:50:59+00:00Added an answer on May 16, 2026 at 6:50 am

    Look at your execution plan / “EXPLAIN PLAN” result – if you are retrieving large amounts of data then there is very little that you can do to improve performance – you could try changing your SELECT statement to only include columns you are interested in, however it won’t change the number of logical reads that you are doing and so I suspect it will only have a neglible effect on performance.

    If you are only retrieving small numbers of records then an index of LogLevel and an index on CreationDate should do the trick.

    UPDATE: SQL server is mostly geared around querying small subsets of massive databases (e.g. returning a single customer record out of a database of millions). Its not really geared up for returning truly large data sets. If the amount of data that you are returning is genuinely large then there is only a certain amount that you will be able to do and so I’d have to ask:

    What is it that you are actually trying to achieve?

    • If you are displaying log messages to a user, then they are only going to be interested in a small subset at a time, and so you might also want to look into efficient methods of paging SQL data – if you are only returning even say 500 or so records at a time it should still be very fast.

    • If you are trying to do some sort of statistical analysis then you might want to replicate your data into a data store more suited to statistical analysis. (Not sure what however, that isn’t my area of expertise)

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

Sidebar

Related Questions

Assume there is a table named myTable with three columns: {**ID**(PK, int, not null),
I need to extract records from a table, copy the data to a second
Let's say I have a table named transaction with transaction_date, deposit, withdrawal fields. There
Assume I have a function that reads data from a MySQL table, manipulates it
Assume I have a table named bookLibrary in which the unique id of a
Assume a table structure of MyTable(KEY, datafield1, datafield2...) . Often I want to either
Assume a table with the following columns: pri_id , item_id , comment , date
Assume a table that uses a natural key and has a number of existing
Assume I'm indexing a table of books. They have title, author, description, etc. I
Assume I have a table called table and I have 3 columns, a, b,

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.