# Different query speeds of elasticsearch and relational database

**URL:** <https://discuss.elastic.co/t/different-query-speeds-of-elasticsearch-and-relational-database/13062>\
**Category:** Elasticsearch\
**Created:** [August 5, 2013, 3:06am UTC](https://discuss.elastic.co/t/different-query-speeds-of-elasticsearch-and-relational-database/13062 "2013-08-05T03:06:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![lnya2014](https://avatars.discourse-cdn.com/v4/letter/l/58956e/32.png) [@lnya2014](https://discuss.elastic.co/u/lnya2014)\
**Post date:** [August 5, 2013, 3:06am UTC](https://discuss.elastic.co/t/different-query-speeds-of-elasticsearch-and-relational-database/13062/1 "2013-08-05T03:06:52Z")

</div>

Hey, I wonder about the query speed of elasticsearch and relational  
database. So I perform an experiment:  
Cpu: Intel(R) Core(TM) i5-3450  
Memory: 32g  
Linux 2.6.32

ElasticSearch doc:

{"id":"9864599","createTime":"1337706360000","category":"1","tos":"965169  
965183 965203 965204 ","from":"1079665","type":"R RA16","corpID":"269228"}  
Mysql record:

+----+------------+--------+--------+---------+---------+------+---------------+---------------+------------+  
| id | ap\_id | status | archiv | user\_id | dept\_id | type |  
create\_time | update\_time | company\_id |

+----+------------+--------+--------+---------+---------+------+---------------+---------------+------------+  
| 1 | 1 | -1 | 1 | 9098 | 0 | 1 |  
1287769309973 | 1287772542536 | 10 |

+----+------------+--------+--------+---------+---------+------+---------------+---------------+------------+

Similar queries:  
select count(approve\_id) CountResult from approve\_ids where user\_id=?;  
select approve\_id from approve\_ids where user\_id=? order by update\_time  
desc limit {CountResult - 100}, 100;

both elasticsearch and mysql have 1800w records, and corresponding index;  
After preloadng the data, execut concurrenttly the queries in 10 threads.  
Query params and resultset are same in elasticsearch and mysql.  
I got the test results:  
Elasticsearch: 461 queries / s, system load: 1+  
Mysql : 949 queries / s, system load: 0.1

Can someboy tell me is this result right, and why?

Thanks.

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 2:23am UTC](https://discuss.elastic.co/t/different-query-speeds-of-elasticsearch-and-relational-database/13062/2 "2017-07-06T02:23:05Z")

</div>


