性能:查询内部的计算,ES vs Mysql

时间:2015-12-24 06:29:20

标签: elasticsearch

在select查询中计算哪个更快,mysql还是弹性搜索?为什么呢?

{
"query" : {
  ...
  },
    "script_fields" : {
         "gross_profit" : {
                 script: "((((doc['price_in_cents'].value * 100)/(100 +#{location.gst_rate})) - doc['cost_in_cents'].value)*(doc['quantity'].value)) "
                          }
           }
       }

   SELECT ((price_in_cents*100)/100/(100+#{location.gst_rate})) - cost_in_cents * quantity) as gross_profit FROM ...


   location.gst_rate is a dynamic variable (Note: Using ruby on rails syntax)

以下是我的mysql架构(它有许多其他列和关系,不包括,因为它们在这里无关紧要):

 Table Name: Sales
 Columns:
 sales_id : integer
 price_in_cents : double
 cost_in_cents : double
 quantity : tiny int

Elastic search Index:
Name: Sales
id: integer
price_in_cents : double
cost_in_cents : double
quantity : tiny int

0 个答案:

没有答案