Add Postgres support for like-for-like benchmark comparisons#3
Open
MrLukeSmith wants to merge 20 commits into
Open
Add Postgres support for like-for-like benchmark comparisons#3MrLukeSmith wants to merge 20 commits into
MrLukeSmith wants to merge 20 commits into
Conversation
…-db-cpus/--db-memory Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…_cpu Comparing a mysql result against a postgres result no longer trips the ProfileMismatch guard (that guard only checks topology/resource fields). The Database row is purely informational.
Postgres has no ROUND(double precision, integer) overload, only ROUND(numeric, integer) - discovered via Task 14's manual Postgres smoke run, which failed with 'function round(double precision, integer) does not exist' when fetching top statement digests.
pg_stat_statements' query text can span multiple lines (e.g. Rails' own multi-line schema-introspection queries), which a bare newline-per-row split shreds into bogus extra rows with empty columns - discovered via Task 14's manual Postgres smoke run, whose top_statements output was garbage. psql's --csv mode quotes multi-line fields per RFC4180, so Ruby's CSV library parses them correctly.
Cheap insurance recommended by the final whole-feature review - this bug was only caught by a live Postgres run; without this assertion, reverting the ::numeric cast would stay green in the unit suite.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
Adds Postgres as a second, selectable database engine so we can compare MySQL vs Postgres performance like-for-like with
bin/bench compare.Change summary
--database mysql|postgresflag onbin/bench run(defaultmysql), backed by a newBench::Enginesregistry and aBench::PostgresClientmirroringBench::MysqlClient.docker-compose.ymlgains apostgresservice; only the selected engine's container is started per run.--mysql-cpus/--mysql-memory→--db-cpus/--db-memory,mysql:→db:inprofiles/*.yml,mysql_cpumetric →db_cpu.bin/bench comparenow shows which engine each side used; comparing MySQL vs Postgres under the same profile is not treated as a mismatch.result.jsonfiles predate thedatabase/db_cpufields and thedb_cpusprofile key — comparing an old result against a new one will show blank values for those fields.Technical considerations
ROUND(double precision, integer)overload (needed an explicit::numericcast), andpg_stat_statements' query text can span multiple lines, which broke naive newline-per-row parsing —PostgresClientnow parsespsql --csvoutput via Ruby'sCSVlibrary instead. Both have regression coverage now, but there's no CI job against real Postgres/MySQL containers, so similar issues would again only surface via manualmise run smoke/--database postgresruns.Gemfilenow bundlespgunconditionally; its native extension needslibpqdev headers on the host (documented in the README).