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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T19:23:31+00:00 2026-06-12T19:23:31+00:00

I am executing the below query to get daily user signin details from my

  • 0

I am executing the below query to get daily user signin details from my table . I posted the sample table and the query i am executing .

Problem

My Query is not executing as range query it examines the whole table . It becomes slow for me . If I index the timestamp column is not useful because there is no major differnce between timestamp in milliseconds . I couldn’t do indexing the timestamp column for a table because my product in a production setup . It will contains millions of rows. How can execute this query as a range one or any better solutions?

MYSQL Table
+—————+—————————————————————————————————————————————————————————————+
| Table | Create Table |

+---------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| SignInDetails | CREATE TABLE `SignInDetails` (
  `USER_ID` bigint(20) DEFAULT NULL,
  `UserName` char(200) DEFAULT NULL,
  `TIMESTAMP` bigint(20) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 |
+---------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

Query

select USER_ID,TIMESTAMP from SignInDetails where TIMESTAMP 
between UNIX_TIMESTAMP(CURRENT_DATE()-INTERVAL 1 DAY)*1000 and 
UNIX_TIMESTAMP(CURRENT_DATE())*1000

Explain Output

    +----+-------------+---------------+------+---------------+------+---------+------+------+-------------+
| id | select_type | table         | type | possible_keys | key  | key_len | ref  | rows | Extra       |
+----+-------------+---------------+------+---------------+------+---------+------+------+-------------+
|  1 | SIMPLE      | SignInDetails | ALL  | NULL          | NULL | NULL    | NULL |   21 | Using where |
+----+-------------+---------------+------+---------------+------+---------+------+------+-------------+

Total Rows In a table

21

  • 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-12T19:23:33+00:00Added an answer on June 12, 2026 at 7:23 pm

    Your desc output doesn’t indicate that timestamp is indexed column. Can you provide the DDL, so that we can see that you actually creating an index for it?

    Alternatively, you could use 2 columns to store the timestamp with milliseconds resolution, one is used for search and the other for extra resolution. I can imagine combinations: datetime/msec, date/bigint-msec, datetime/bigint-msec. Actual combination is going to depend on what kind of queries are used most frequently.

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

Sidebar

Related Questions

A user is getting an error on their phone when executing the code below,
Consider the SQL query below: SELECT * FROM opening_hours WHERE week_day = WEEKDAY(NOW()) +
I get a very common crash below from the code below. I thought my
I did spend an hour searching before I posted about this problem. The table
how do i get the array value from below code?. and use while loop
I am trying to get the sql query below to work but I am
I am executing the below query with Oracle ANSI left outer join syntax,It's returning
I have some problem regarding the search in mysql. Below is my query. SELECT
I need to get a resultset via executing a native query in Hibernate. Though
I am creating the below table dynamically using jQuery... After executing my code 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.