Large integer IDs being rounded in Metabase (loss of precision)

Hi all,

I’ve noticed that when I filter on a large integer ID in Metabase, the number displayed in the results doesn’t match the number I typed.

For example:

  • I filter on:
    46905316994864128

  • Metabase shows me:
    46905316994864130

So the value is shifted by +2.

From what I can tell, this is because the ID is larger than JavaScript’s safe integer limit (2^53 - 1 = 9,007,199,254,740,992), and Metabase uses JavaScript’s Number type on the frontend. That means large 64-bit integers (like ClickHouse BIGINT IDs) can’t always be represented exactly and get rounded.

This is problematic for us because we rely on exact IDs for filtering and debugging.

Questions:

  1. Is there a recommended way to handle large integer IDs in Metabase?

  2. Would casting IDs to strings in the data model be the best workaround?

  3. Are there any plans for Metabase to support exact 64-bit integers (perhaps by treating them as strings)?

Thanks in advance!

What version of Metabase are you running?

I’m not able to reproduce an issue here on Metabase 0.56.5.1 with PostgreSQL 17.6. I tried creating a table with one bigint column, inserted your numbers into it, and was able to filter for them individually with no rounding, returning one row each time. I used the notebook editor to select all the rows then clicked on individual values to filter by them.

I wonder if this is specific to ClickHouse?

EDIT: Did some research and tested with ClickHouse 25, CH seems to be one of the databases that gets victimized by the JS 2^53 rounding quirk. PostgreSQL does not, it may have been updated to use the JS bigint library. Can confirm the ClickHouse HTTP API returns the correct values, so its something in Metabase that’s messing things up.

This is a long-standing issue in Metabase (like 2017, sub-10000 issue number long standing) that’s been worked on numerous times over the years. I’ll link the issue below for your perusal.