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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T06:16:49+00:00 2026-06-06T06:16:49+00:00

Have a really large table consisting of 8 fields (I know, unprecise). In my

  • 0

Have a really large table consisting of 8 fields (I know, unprecise).

In my application I run this SELECT repeatedly:

SELECT d1, time, s1, s2 from Collection WHERE (d1 = 1) and (s1 = 1) and (time BETWEEN 5666300000 AND 566630700);

I run this SELECT with different time ranges. d1 is a field with 200-300 different values, same with s1. Primary keys are d1, time, s1.

I’m looking for tips on optimizing my table structure and query. The thing is that the time field is not in ascending/descending order. So this can be a query requiring some time. I was wondering about indexing my time field. Would I then have to change my query? I that case, how?

Is there any obv wrong with my query I’m not seeing? This runs slow in my application.
Thanks!

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

    I woild recommend building your clustered index (primary key) on time + d1 + s1 (in that order). This will ensure that the data is physically stored in order of time and then d1 and s1

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

Sidebar

Related Questions

Suppose you have a really large table, say a few billion unordered rows, and
I have a really large table (around 32 columns and 1000+ rows) which I'm
I have a question about the ALTER TABLE command on a really large table
I have a large PHP generated table of users from a database. Each username
I have done database optimization for dbs upto 3GB size. Need a really large
In software companies I have seen it's really hard to work on very large
I have really no idea why I'm asking this as this a really completely
Im new to iPhone development and I have really taken this to me. I
I really have no idea why I'm struggling with this so much. I'm scraping
I really have no idea how to go about this. So far all I

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.