These are chat archives for damianh/Cedar
"Limit (cost=676.50..676.50 rows=1 width=13) (actual time=615.366..615.366 rows=1 loops=1)" " -> Sort (cost=676.50..676.63 rows=54 width=13) (actual time=615.362..615.362 rows=1 loops=1)"
that's what I got
SELECT streams.id_internal, streams.is_deleted, events.stream_version FROM streams LEFT JOIN events ON events.stream_id_internal = streams.id_internal AND (events.stream_version >= _expected_version OR _expected_version < 0) WHERE streams.id = _stream_id ORDER BY events.ordinal DESC LIMIT 1;
SELECT TOP 1 WHERE version >= expected_version
some_known_stream_sequence.next_val()and messing up the versioning...
Important: To avoid blocking concurrent transactions that obtain numbers from the same sequence, a nextval operation is never rolled back; that is, once a value has been fetched it is considered used, even if the transaction that did the nextval later aborts. This means that aborted transactions might leave unused "holes" in the sequence of assigned values.