Redshift Spectrum 比 Athena 慢得多?

Redshift Spectrum much slower than Athena?

我们的数据以 JSON 的形式存储在 S3 中,没有分区。直到今天我们只使用 athena,但现在我们尝试了 Redshift Spectrum。

我们运行同一个查询两次。 一次使用 Redshift Spectrum,一次使用 Athena。两者都连接到 S3 中的相同数据。

使用 Redshift Spectrum 这份报告需要很长时间(超过 15 分钟)到 运行,而使用 Athena 只需要 10 秒就可以到 运行。

在两种情况下,我们在 aws 控制台中 运行 的查询是这样的:

SELECT "events"."persistentid" AS "persistentid",
  SUM(1) AS "sum_number_of_reco"
FROM "analytics"."events" "events"
GROUP BY "events"."persistentid"

知道发生了什么事吗? 谢谢

Redshift Spectrum 处理能力受 Redshift 集群大小限制。

您可以从Improving Amazon Redshift Spectrum Query Performance

中找到信息

The Amazon Redshift query planner pushes predicates and aggregations to the Redshift Spectrum query layer whenever possible. When large amounts of data are returned from Amazon S3, the processing is limited by your cluster's resources. Redshift Spectrum scales automatically to process large requests. Thus, your overall performance improves whenever you can push processing to the Redshift Spectrum layer.

另一方面,Athena 为查询使用优化的资源量,这可能比小型 Redshift 集群所能获得的 Spectrum 更大。

我们对不同 Redshift 集群大小的 Redshift Spectrum 性能测试证实了这一点。