7

I noticed QLDB does not support LIMIT or SKIP query parameters required to implement basic pagination.

Is this going to be supported in the future or is there some other way to implement pagination in QLDB?

Alko
  • 672
  • 10
  • 21

1 Answers1

8

LIMIT/SKIP is not currently supported. QLDB is purpose built for data ingestion. We recommend doing reporting and analytics in another purpose built database.

Let's consider a banking application with 2 use-cases:

  1. Moving money between accounts
  2. Providing monthly statements

The first is a very good fit for QLDB, where indexes are being used to read balances and then few documents are being updated or created. Under OCC, QLDB makes it easy to write these transactions correctly and performance should be very good. For example, if an account has $50 remaining and two competing transactions try to deduct $50, only 1 will succeed (the other will fail to commit). Meanwhile, other transactions will continue to succeed. Beyond being simple and performant, you also get integrity via the QLDB hash chain and proof system.

The second is not a good fit. To compute a statement, we would need to lookup transactions for an account. But, what happens if that account changes (maybe somebody just sent you some money!) while we're doing the lookup? Again, under OCC, we will fail the transaction and the statement generation will need to retry. For a small bank, that's probably fine, but I think you can see where this is going. QLDB is purpose built for data ingestion, and the further you stray from what it was built for, the poorer the performance will be.

This begs the question of how to actually do these queries in another database. You can use the S3 Export or Kinesis Data Streaming features to get data out. S3 Exports are better suited for bulk operations (which many analytic databases prefer, e.g. Redshift), while Streams are better for real-time analytics (e.g. using ElasticSearch).

Conversely, I would not recommend using Redshift or ElasticSearch for the first use-case as you will not get the performance, integrity or durability that databases designed for OLTP use-cases offer (e.g. QLDB, DynamoDb, Aurora).

Marc
  • 928
  • 5
  • 8
  • 3
    But this means you will always need to have another database besides QLDB even for some simple operations. I did some testing and inserted 1 million lines into QLDB and then ran count query to see if all were successfully added but the query fails after 100seconds since it cannot compute it. That is some horrible performance if you ask me. – Tadej Vengust Jan 06 '20 at 07:49
  • Hi Tadej and thanks for your feedback. QLDB does not optimize count queries (nor does DynamoDB). I think it is a true statement that either QLDB supports all the queries you need OR you would need split OLAP concerns out. There are examples of both types of customers, but I expect many to be in the second category (especially given that QLDB was recently launched). Other than access to functionality, there are many good reasons to split OLTP/OLAP, and we highly recommend doing so. This may be a bit of a paradigm shift for some, similar to that of microservices. – Marc Jan 06 '20 at 18:33