Couchbase 4 beta “ORDER BY” performance

无人久伴 提交于 2020-01-06 01:30:16

问题


I have one question about performance of "ORDER BY" in Couchbase 4 Beta (Ubuntu 64bits).

I create a Bucket "testing" and a primary index:

CREATE PRIMARY INDEX `testing-idx` ON `testing` USING GSI;

And a second index:

CREATE INDEX testing_field_value_idx ON `testing`(field_value) USING GSI

In my bucket I have items such as:

{
  "type": "entry",
  "field_name": "field-testing",
  "field_value": "1 bla bla bla bla bla bla bla bla"
},
{
  "type": "entry",
  "field_name": "field-testing",
  "field_value": "2 bla bla bla bla bla bla bla bla"
},
{
  "type": "entry",
  "field_name": "field-testing",
  "field_value": "3 bla bla bla bla bla bla bla bla"
}
...

When I execute the query without ORDER BY the response is fast (milliseconds):

SELECT field_value FROM testing LIMIT 10;

1.000 items: 53 ms
100.000 items: 82 ms

But when I execute the query with ORDER BY, the response is slow (seconds):

SELECT field_value FROM testing ORDER BY field_value ASC LIMIT 10;

1.000 items: 4.6 secs
100.000 items: 6.2 secs

How to get better performance with ORDER BY?

** All the queries are executed in "cbq".

来源:https://stackoverflow.com/questions/30670366/couchbase-4-beta-order-by-performance

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!