Home / Input Output / cardano-db-sync
Mar 20, 8-9 PM (0)
Mar 20, 9-10 PM (0)
Mar 20, 10-11 PM (0)
Mar 20, 11-12 AM (0)
Mar 21, 12-1 AM (0)
Mar 21, 1-2 AM (0)
Mar 21, 2-3 AM (0)
Mar 21, 3-4 AM (0)
Mar 21, 4-5 AM (0)
Mar 21, 5-6 AM (0)
Mar 21, 6-7 AM (0)
Mar 21, 7-8 AM (0)
Mar 21, 8-9 AM (0)
Mar 21, 9-10 AM (0)
Mar 21, 10-11 AM (0)
Mar 21, 11-12 PM (0)
Mar 21, 12-1 PM (0)
Mar 21, 1-2 PM (0)
Mar 21, 2-3 PM (0)
Mar 21, 3-4 PM (0)
Mar 21, 4-5 PM (0)
Mar 21, 5-6 PM (0)
Mar 21, 6-7 PM (0)
Mar 21, 7-8 PM (0)
Mar 21, 8-9 PM (0)
Mar 21, 9-10 PM (0)
Mar 21, 10-11 PM (0)
Mar 21, 11-12 AM (0)
Mar 22, 12-1 AM (0)
Mar 22, 1-2 AM (0)
Mar 22, 2-3 AM (0)
Mar 22, 3-4 AM (0)
Mar 22, 4-5 AM (0)
Mar 22, 5-6 AM (0)
Mar 22, 6-7 AM (0)
Mar 22, 7-8 AM (0)
Mar 22, 8-9 AM (0)
Mar 22, 9-10 AM (0)
Mar 22, 10-11 AM (0)
Mar 22, 11-12 PM (0)
Mar 22, 12-1 PM (0)
Mar 22, 1-2 PM (0)
Mar 22, 2-3 PM (0)
Mar 22, 3-4 PM (0)
Mar 22, 4-5 PM (0)
Mar 22, 5-6 PM (0)
Mar 22, 6-7 PM (0)
Mar 22, 7-8 PM (0)
Mar 22, 8-9 PM (0)
Mar 22, 9-10 PM (0)
Mar 22, 10-11 PM (0)
Mar 22, 11-12 AM (0)
Mar 23, 12-1 AM (0)
Mar 23, 1-2 AM (0)
Mar 23, 2-3 AM (0)
Mar 23, 3-4 AM (0)
Mar 23, 4-5 AM (0)
Mar 23, 5-6 AM (0)
Mar 23, 6-7 AM (0)
Mar 23, 7-8 AM (0)
Mar 23, 8-9 AM (0)
Mar 23, 9-10 AM (0)
Mar 23, 10-11 AM (0)
Mar 23, 11-12 PM (0)
Mar 23, 12-1 PM (2)
Mar 23, 1-2 PM (1)
Mar 23, 2-3 PM (0)
Mar 23, 3-4 PM (0)
Mar 23, 4-5 PM (0)
Mar 23, 5-6 PM (1)
Mar 23, 6-7 PM (0)
Mar 23, 7-8 PM (0)
Mar 23, 8-9 PM (0)
Mar 23, 9-10 PM (0)
Mar 23, 10-11 PM (2)
Mar 23, 11-12 AM (0)
Mar 24, 12-1 AM (0)
Mar 24, 1-2 AM (0)
Mar 24, 2-3 AM (1)
Mar 24, 3-4 AM (0)
Mar 24, 4-5 AM (0)
Mar 24, 5-6 AM (0)
Mar 24, 6-7 AM (0)
Mar 24, 7-8 AM (0)
Mar 24, 8-9 AM (0)
Mar 24, 9-10 AM (0)
Mar 24, 10-11 AM (0)
Mar 24, 11-12 PM (0)
Mar 24, 12-1 PM (0)
Mar 24, 1-2 PM (0)
Mar 24, 2-3 PM (0)
Mar 24, 3-4 PM (0)
Mar 24, 4-5 PM (0)
Mar 24, 5-6 PM (0)
Mar 24, 6-7 PM (0)
Mar 24, 7-8 PM (0)
Mar 24, 8-9 PM (0)
Mar 24, 9-10 PM (0)
Mar 24, 10-11 PM (0)
Mar 24, 11-12 AM (0)
Mar 25, 12-1 AM (0)
Mar 25, 1-2 AM (0)
Mar 25, 2-3 AM (0)
Mar 25, 3-4 AM (0)
Mar 25, 4-5 AM (0)
Mar 25, 5-6 AM (0)
Mar 25, 6-7 AM (0)
Mar 25, 7-8 AM (0)
Mar 25, 8-9 AM (0)
Mar 25, 9-10 AM (0)
Mar 25, 10-11 AM (3)
Mar 25, 11-12 PM (2)
Mar 25, 12-1 PM (0)
Mar 25, 1-2 PM (0)
Mar 25, 2-3 PM (0)
Mar 25, 3-4 PM (0)
Mar 25, 4-5 PM (0)
Mar 25, 5-6 PM (1)
Mar 25, 6-7 PM (0)
Mar 25, 7-8 PM (0)
Mar 25, 8-9 PM (0)
Mar 25, 9-10 PM (0)
Mar 25, 10-11 PM (0)
Mar 25, 11-12 AM (0)
Mar 26, 12-1 AM (0)
Mar 26, 1-2 AM (0)
Mar 26, 2-3 AM (0)
Mar 26, 3-4 AM (0)
Mar 26, 4-5 AM (0)
Mar 26, 5-6 AM (0)
Mar 26, 6-7 AM (0)
Mar 26, 7-8 AM (0)
Mar 26, 8-9 AM (0)
Mar 26, 9-10 AM (0)
Mar 26, 10-11 AM (0)
Mar 26, 11-12 PM (0)
Mar 26, 12-1 PM (1)
Mar 26, 1-2 PM (0)
Mar 26, 2-3 PM (0)
Mar 26, 3-4 PM (0)
Mar 26, 4-5 PM (1)
Mar 26, 5-6 PM (0)
Mar 26, 6-7 PM (0)
Mar 26, 7-8 PM (0)
Mar 26, 8-9 PM (0)
Mar 26, 9-10 PM (0)
Mar 26, 10-11 PM (0)
Mar 26, 11-12 AM (0)
Mar 27, 12-1 AM (0)
Mar 27, 1-2 AM (0)
Mar 27, 2-3 AM (0)
Mar 27, 3-4 AM (0)
Mar 27, 4-5 AM (0)
Mar 27, 5-6 AM (0)
Mar 27, 6-7 AM (0)
Mar 27, 7-8 AM (0)
Mar 27, 8-9 AM (0)
Mar 27, 9-10 AM (0)
Mar 27, 10-11 AM (0)
Mar 27, 11-12 PM (0)
Mar 27, 12-1 PM (0)
Mar 27, 1-2 PM (0)
Mar 27, 2-3 PM (0)
Mar 27, 3-4 PM (0)
Mar 27, 4-5 PM (0)
Mar 27, 5-6 PM (0)
Mar 27, 6-7 PM (0)
Mar 27, 7-8 PM (0)
Mar 27, 8-9 PM (0)
15 commits this week Mar 20, 2026 - Mar 27, 2026
Fix ghc-9.12 nix build
This fixes builds for the dependencies haskell-language-server and
proto-lens.

proto-lens fails with:

    Error: [Cabal-6661]
    filepath wildcard 'proto-lens-imports/google/protobuf/descriptor.proto'
    refers to the directory 'proto-lens-imports/google/protobuf', which does not exist or is not a directory.
    filepath wildcard 'proto-lens-imports/google/protobuf/descriptor.proto'
    does not match any files.

However, SRP is currently required because the released version does not
support ghc-9.12.

The previous haskell-language-server did not support ghc-9.12, so we are
upgrading it to the latest version
Fix proto-lens ghc-9.12 build
The proto-lens source-repository-package build fails with:

    Error: [Cabal-6661]
    filepath wildcard 'proto-lens-imports/google/protobuf/descriptor.proto'
    refers to the directory 'proto-lens-imports/google/protobuf', which does not exist or is not a directory.
    filepath wildcard 'proto-lens-imports/google/protobuf/descriptor.proto'
    does not match any files.

However, SRP is currently required because the released version does not
support ghc-9.12.
Make sure we're using indexes during rollbacks
Fixes https://github.com/IntersectMBO/cardano-db-sync/issues/2083

The `queryMinRefId` query uses
```sql
SELECT id FROM <table> WHERE <field> >= $1 ORDER BY id ASC LIMIT 1.
```

The planner sometimes picks a bad plan:

```sql
Index Scan using tx_pkey on tx
  Filter: (block_id >= $1)
```

the filter is not Index Cond, so this ends up in a sequential scan.
The index refers to the primary key and is only used for sorting.

Instead we use a simpler query without ORDER BY:

SELECT id FROM <table> WHERE <field> >= $1 LIMIT 10000
This forces the planner to use the field's index.
The results are fetched and the minimum is found in Haskell.
Near the tip this returns only a handful of rows.

If there are more than 10000 matching rows (large rollback),
we fall back to the original ORDER BY id ASC LIMIT 1 query.
Make sure we're using indexes during rollbacks
    Fixes https://github.com/IntersectMBO/cardano-db-sync/issues/2083

    The `queryMinRefId` query uses
    ```sql
    SELECT id FROM <table> WHERE <field> >= $1 ORDER BY id ASC LIMIT 1.
    ```

    The planner sometimes picks a bad plan:

    ```sql
    Index Scan using tx_pkey on tx
      Filter: (block_id >= $1)
    ```

    the filter is not Index Cond, so this ends up in a sequential scan.
    The index refers to the primary key and is only used for sorting.

    Instead we use a simpler query without ORDER BY:

    SELECT id FROM <table> WHERE <field> >= $1 LIMIT 10000
    This forces the planner to use the field's index.
    The results are fetched and the minimum is found in Haskell.
    Near the tip this returns only a handful of rows.

    If there are more than 10000 matching rows (large rollback),
    we fall back to the original ORDER BY id ASC LIMIT 1 query.
Make sure we're using indexes during rollbacks
Fixes https://github.com/IntersectMBO/cardano-db-sync/issues/2083

The `queryMinRefId` query uses
```sql
SELECT id FROM <table> WHERE <field> >= $1 ORDER BY id ASC LIMIT 1.
```

The planner sometimes picks a bad plan:

```sql
Index Scan using tx_pkey on tx
  Filter: (block_id >= $1)
```

the filter is not Index Cond, so this ends up in a sequential scan.
The index refers to the primary key and is only used for sorting.

Instead we use a simpler query without ORDER BY:

SELECT id FROM <table> WHERE <field> >= $1 LIMIT 10000
This forces the planner to use the field's index.
The results are fetched and the minimum is found in Haskell.
Near the tip this returns only a handful of rows.

If there are more than 10000 matching rows (large rollback),
we fall back to the original ORDER BY id ASC LIMIT 1 query.
Make sure we're using indexes during rollbacks
    Fixes https://github.com/IntersectMBO/cardano-db-sync/issues/2083#issuecomment-4110278201
    for 13.6.0.5.
    The planner sometimes uses a query similar to

    Index Scan using tx_pkey on tx
      Filter: (block_id >= $1)

    the filter is not Index Cond, so this ends up in a sequential scan.
    The index refers to the primary key and is only used for sorting.
    Instead we want to use

    Sort (top-N heapsort)
      -> Index Scan using idx_tx_block_id
           Index Cond: (block_id >= $1)

    With this change we're forcing a similar plan

    Aggregate
      -> Index Scan using idx_tx_block_id
           Index Cond: (block_id >= $1)

    making sure we're using the Index Cond and then sorting.
Make sure we're using indexes during rollbacks
Fixes https://github.com/IntersectMBO/cardano-db-sync/issues/2083#issuecomment-4110278201
The planner sometimes uses a query similar to

Index Scan using tx_pkey on tx
  Filter: (block_id >= $1)

the filter is not Index Cond, so this ends up in a sequential scan.
The index refers to the primary key and is only used for sorting.
Instead we want to use

Sort (top-N heapsort)
  -> Index Scan using idx_tx_block_id
       Index Cond: (block_id >= $1)

With this change we're forcing a similar plan

Aggregate
  -> Index Scan using idx_tx_block_id
       Index Cond: (block_id >= $1)

making sure we're using the Index Cond and then sorting.