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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T12:36:43+00:00 2026-06-13T12:36:43+00:00

I have a table/schema with two columns named day of DateTime and user_id of

  • 0

I have a table/schema with two columns named day of DateTime and user_id of Integer. Right know I made both columns indexed.

Is performance improvements gained from indexing worth it, considering huge fraction of additional space used by the index and there are only two columns? How do you justify them?

How does this differ if I use MongoDB or MySQL?

  • 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-13T12:36:44+00:00Added an answer on June 13, 2026 at 12:36 pm

    Is performance improvements gained from indexing worth it

    Depends on the queries you intend to run.

    • If you have something like: WHERE day = ..., then you’ll need an index whose leading edge contains day. If properly used, indexes can speed-up querying many orders of magnitude, especially on large data sets.
    • OTOH, every additional index costs space/cache and INSERT/UPDATE/DELETE performance.

    At the end of the day, I recommend you measure on realistic amounts of data and come to your own conclusions.

    BTW, If you are using InnoDB, then your table is clustered (see also: Understanding InnoDB clustered indexes) and the whole table is effectively stored in the primary index. The secondary indexes in clustered tables contain copy of the PK fields, which (I’m assuming) is user_id in this case. And since we only have two fields in the table, the secondary index on { day } will cover the user_id as well, avoiding a double-lookup that could otherwise happen in a clustered table. Effectively, you’ll end-up with two separate (but synchronized) B-Trees and an index-only scan no matter which one of them you access (which is good). Of course, you could explicitly make a composite index on {day, user_id} instead of just { day }, for a very similar effect.

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

Sidebar

Related Questions

I have two tables, both named as say, Employee in two different schema HR
I have a table named Books which contains 3 columns. TableName: Books Columns: BookId
I have a table which uses two columns to represent its primary key, a
I have a table with three columns, A, B and C. Two of these
I have two table in my data base As below: CUSTOMER ( ID integer
I have a table with five columns. The two columns, together, make up the
I have two tables with identical schema. Let's name them TestTable and TestTableTemp .
I have two schemas S1 and S2 with identical table structure. I`ll start with
I have two tables userdetails and blog question The schema is UserDetails: connection: doctrine
I have two tables in my database schema that represent an entity having a

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.