-
-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat!: add wait/handle time to ProcessedMessage
#105
Conversation
b983a6c
to
07ffd52
Compare
💪🏻 Ok, I think this is the best way to handle but @Chris53897, @SherinBloemendaal, @bobvandevijver, any thoughts? |
07ffd52
to
1606748
Compare
1606748
to
23cc03e
Compare
LGTM 👍🏻 |
@kbond how about storing micro seconds for sub second precision? |
I was thinking about this. My only concern is timestamp fields don't store partial seconds (IIRC). Maybe not an issue but the timestamps and wait/handle time's won't match up. Thinking to store as Need to make this decision before 0.5.0 to avoid a BC break for existing data... |
here i used |
Ok cool, I have tests for different db platforms now so let's see! |
Why did you use decimal instead of float for the type? From what I'm seeing, a float would require less bytes than a 16,6 decimal. |
Ok, good to know! Decimal it is |
i'm actually not sure if my comment back then was a typo and i meant postgres. SELECT avg(n) FROM unnest('{0.1,0.2}'::float[]) n; # 0.15000000000000002
SELECT avg(n) FROM unnest('{0.1,0.2}'::decimal[]) n; # 0.15000000000000000000 |
I watched this also: https://planetscale.com/learn/courses/mysql-for-developers/schema/decimals Which talks about the same thing but... For milli or even micro seconds, this approximation would be fine, no? |
sure it'll use more bytes for storage, but is that a concern given the other columns on this table which are far larger? |
Why not just store the milliseconds (or even micro) in the int field? I very much doubt that (assuming 64 bit signed, bigint in mariadb and postgres) wait time and handle time would ever by larger than 2.56*10^9 hours. Unsigned ints are not supported on postgres, so that is not an option. Personally I always try to stay away from floats whenever possible. |
Ok, I was also thinking storing the milliseconds. I think I'll do that. I doubt there's a need for knowing down to the microsecond. |
Fixes #97.
This is a BC break and will require existing apps to create a migration. The migration would need to either clear the existing
ProcessedMessage
's or calculate the values when adding the fields.This isn't ideal but feels like the best way to eliminate the timestamp diff db logic that DB platforms all handle differently.
TODO:
UPGRADE.md