Search code examples
sqlamazon-web-servicesamazon-athenaamazon-quicksight

Equivalent of WITH (NOLOCK) in AWS Athena


I tried to use "WITH (NOLOCK)" in a SQL query in AWS Athena, and it doesn't seem to recognize the "NOLOCK". It throws an error on the NOLOCK specifically. Is there some kind of equivalent that should be used instead?

Thanks so much for the help!

Here is my query: SELECT * FROM "usage_dw_large"."usage_sites" WITH (NOLOCK) limit 10;

Here is the error: line 1:46: mismatched input 'with'. expecting: ',', '.', 'as', 'cross', 'except', 'for', 'full', 'group', 'having', 'inner', 'intersect', 'join', 'left', 'limit', 'natural', 'order', 'right', 'tablesample', 'union', 'where', <eof>, <identifier> (service: amazonathena; status code: 400; error code: invalidrequestexception; request id: 9aec79f3-9073-4adb-bff8-203fb617eb3e; proxy: null)


Solution

  • There is no equivalent. AWS Athena was built on PrestoDB and here is an except from PrestoDB's docs:

    Do not mistake the fact that Presto understands SQL with it providing the features of a standard database. Presto is not a general-purpose relational database. It is not a replacement for databases like MySQL, PostgreSQL or Oracle. Presto was not designed to handle Online Transaction Processing (OLTP). This is also true for many other databases designed and optimized for data warehousing or analytics.

    There are no row/table locks like traditional relational databases so this keyword/feature is not included or needed.