srikanth Gattu
srikanth Gattu

Reputation: 23

How to make the count(*) query faster?

I have the table(named users_events) consists of below columns

  1. date(date_time)
  2. eventid(autoincrement field) PRIMARY KEY
  3. two foreign keys
  4. two long text fields
  5. three integer fields and having the indexes on date_time column(btree) and two text fields(fulltext).

We have 14 million records in the table. When I try below query it's taking more than 30 seconds

 select count(*) from users_events

please help me out to how to reduce query time..

Upvotes: 1

Views: 556

Answers (1)

Rick James
Rick James

Reputation: 142528

Build and maintain a Summary Table

Upvotes: 2

Related Questions