LCORE-1249: PostgreSQL benchmarks#1152
Conversation
WalkthroughBenchmark tests in Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
tests/benchmarks/test_app_database.py (1)
734-735:⚠️ Potential issue | 🟠 MajorBug: float division produces user IDs that never match stored records.
Line 735 uses
/(float division), sostr(records_to_insert / 2)yields"50.0"instead of"50". Since records are stored withstr(id)fromrange()(producing"0","1", …), the querieduser_idwill never match, and every "list for one user" benchmark silently measures an empty-result query on non-empty databases.The analogous
retrieve_conversationhelpers on lines 821 and 909–910 correctly use//.🐛 Proposed fix
- user_id = str(records_to_insert / 2) + user_id = str(records_to_insert // 2)
🧹 Nitpick comments (1)
tests/benchmarks/test_app_database.py (1)
981-1350: Consider reducing duplication withpytest.mark.parametrizeor a test factory.The 24 new PostgreSQL test functions are structurally identical to the 24 SQLite tests — only the fixture differs. This doubles the maintenance surface (~360 lines). A common pattern is to parametrize over a fixture name using
request.getfixturevalue:`@pytest.mark.parametrize`("db_fixture", ["sqlite_database", "postgres_database"]) def test_store_new_user_conversations_empty_db(request, db_fixture, benchmark): request.getfixturevalue(db_fixture) benchmark_store_new_user_conversations(benchmark, 0)This would collapse each pair into a single function and make it trivial to add new backends later.
Description
LCORE-1249: PostgreSQL benchmarks
Type of change
Tools used to create PR
Related Tickets & Documents
Summary by CodeRabbit