在Amazon Dynamo DB中编写复杂查询(数学表达式) [英] Writing Complex queries in Amazon Dynamo DB(Mathematical expressions)

查看:88
本文介绍了在Amazon Dynamo DB中编写复杂查询(数学表达式)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已从mysql切换到Dynamo DB。在mysql中,我使用了一个查询来获取所有接近特定纬度和经度的用户。查询是

I have switched from mysql to Dynamo DB .In mysql i have used a query for fetching all the users nearer to a particular latitude and longitude.The query is

SELECT *,SQRT( POW( 69.1 * ( latitude - $latitude) , 2 ) + POW( 69.1 * ( $longitude - longitude ) * COS( latitude / 57.3 ) , 2 ) ) AS distance FROM coupon WHERE is_active='Y' HAVING distance<=$radius

是否可以创建像Dynamo DB中的查询。我使用PHP作为后端

is it possible to create a query like in Dynamo DB.I am using PHP as my Backend

推荐答案

不, Amazon DynamoDB 不提供类似这样的复杂SQL查询,毕竟,当您想使用 NoSQL 数据库;)

No, Amazon DynamoDB does not offer complex SQL queries like this one out of the box, after all, something has to go when you want to use a NoSQL database ;)

但是,考虑到DynamoDB专为需要快速且可预测的性能和无缝可伸缩性的用例而开发,通常分别表示大型数据集,它与 Amazon Elastic MapReduce(Amazon EMR)集成例如:

However, given that DynamoDB has been developed specifically for use cases requiring fast and predictable performance with seamless scalability, which usually implies respectively large datasets, it provides integration with Amazon Elastic MapReduce (Amazon EMR) for use cases like yours:


Amazon DynamoDB还与Amazon Elastic MapReduce(Amazon
EMR)集成。 Amazon EMR允许企业使用托管在
AWS上的即付即用Hadoop框架对大型数据集执行
的复杂分析。 [...]企业还可以使用
Amazon EMR来访问多个商店(即Amazon DynamoDB,
Amazon RDS和Amazon S3)中的数据,对该合并后的
数据集进行复杂的分析,并将此工作的结果存储在Amazon S3中。

Amazon DynamoDB also integrates with Amazon Elastic MapReduce (Amazon EMR). Amazon EMR allows businesses to perform complex analytics of their large datasets using a hosted pay-as-you-go Hadoop framework on AWS. [...] Businesses can also use Amazon EMR to access data in multiple stores (i.e. Amazon DynamoDB, Amazon RDS, and Amazon S3), do complex analysis over this combined dataset, and store the results of this work in Amazon S3.

您可能想读入在Amazon DynamoDB中导出,导入,查询和联接表使用Amazon EMR获取详细信息,其中总结了实时查询使用类似SQL的语句(HiveQL)的Amazon DynamoDB数据。尽管 HiveQL 提供了比DynamoDB本身更多的功能,但它仍然是简单的类似SQL的查询语言,以及像您这样的数学表达式都不会包含在内。

You may want to read into Exporting, Importing, Querying, and Joining Tables in Amazon DynamoDB Using Amazon EMR for details, which summarizes Querying live Amazon DynamoDB data using SQL-like statements (HiveQL), amongst other things. While HiveQL provides a bit more than DynamoDB itself, it is still a simple SQL-like query language, and mathematical expressions like yours are not covered.

对于这些,您需要深入研究 Hadoop和MapReduce (由DynamoDB EMR集成提供),因为它可以让您做很多事情数据所需的任何内容(请参见例如如何使用自定义创建作业流程JAR )。

For these you'd need to dive into Hadoop and MapReduce (as provided by the DynamoDB EMR integration), as it allows you to do pretty much anything what you want with your data (see e.g. How to Create a Job Flow Using a Custom JAR).

这篇关于在Amazon Dynamo DB中编写复杂查询(数学表达式)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆