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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T16:02:10+00:00 2026-05-20T16:02:10+00:00

I have a table t1 and two indexes: create index if not exists timeindex

  • 0

I have a table t1 and two indexes:

create index if not exists timeindex on t1(time, "Bytes Received")
create index if not exists filenameindex on t1(filename)

The next query executes fast enough:

select "Bytes Received" from t1 where time>="11:19:31.18" and time <= "11:19:36.18"

But when I add an additional condition to WHERE statement the query slows down tremendously

select "Bytes Received" 
    from t1 
    where time>="11:19:31.18" and time <= "11:19:36.18"
    and filename = "SE12.log"

I’ve tried to create a new index t1(time, "Bytes Received", filename) but execution speed didn’t changed.

How should I change the indexes in the table to speed up the query?

  • 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-20T16:02:11+00:00Added an answer on May 20, 2026 at 4:02 pm

    Use BETWEEN and the following index:

    CREATE INDEX IF NOT EXISTS fntimeindex ON t1(filename ASC, time ASC);
    SELECT "Bytes Received"
      FROM t1 INDEXED BY fntimeindex
      WHERE filename = 'SE12.log'
       AND time BETWEEN '11:19:31.18' AND '11:19:36.18';
    

    Also note that in SQL strings are enclosed in simple quotes (double quotes are for table, schemas and column names).

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

Sidebar

Related Questions

I have a table with two indexes – PK clustered index and non-clustered index.
I have large table. consisting of only 3 columns (id(INT),bookmarkID(INT),tagID(INT)).I have two BTREE indexes
I have table with two columns (startdate & enddate) and I have two submission
i work with php/Mysql i have table with two cols (date , cash) with
I have two table like this table_CN (_id, name, phone, favorite, title) table_EN (_id,
I have two table emptable1(empid,status) emptable2(empid,week) i want to select all the empid whose
i have two table: declare @t1 table (id int) declare @t2 table (id int)
I have two table first is TABLE_SUBJECT and second is TABLE_CHAPTER.Now i want to
i have two table. Records and Villas Records table : ID, VID (Villa ID),
I have two table Employee and Salary table, salary consists Salary of employee in

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.