Skip to content

Seba/fixing some issues#36

Merged
sebastianwebber merged 4 commits intomainfrom
seba/fixing-some-issues
Feb 5, 2026
Merged

Seba/fixing some issues#36
sebastianwebber merged 4 commits intomainfrom
seba/fixing-some-issues

Conversation

@sebastianwebber
Copy link
Contributor

fixes #34
fixes #22
fixes #5
fixes #12

Add documentation to clarify that total_cpu parameter should represent
logical CPU cores (including hyperthreading), not just physical cores.

This resolves confusion about whether an 8-core CPU with hyperthreading
should report 8 or 16 cores. The API is designed to work with logical
cores (16 in this example) as PostgreSQL benefits from hyperthreading
with 15-40% performance improvement.

Added documentation in:
- Input struct with inline comments and examples
- CLI help text for --cpus flag
- README with explanation and rationale

Closes #34

Signed-off-by: Sebastian Webber <sebastian@swebber.me>
Change Mixed and Desktop profile constants from mixed case to uppercase
to match Set() method behavior which converts input to uppercase.

Before this fix, pgconfigctl tune rejected --profile=Mixed and
--profile=Desktop even though they appeared in valid options list.

Changes:
- Update Mixed from "Mixed" to "MIXED" constant
- Update Desktop from "Desktop" to "DESKTOP" constant
- Add comprehensive unit tests for profile.Set() method
- Add CLI integration tests validating all profile parsing scenarios
- Export RootCmd in root.go to enable testing

Closes #22

Signed-off-by: Sebastian Webber <sebastian@swebber.me>
Windows PostgreSQL ≤ 17 cannot exceed 2097151 kB (~2GB) for work_mem
and maintenance_work_mem due to Windows LLP64 model where sizeof(long)
remains 4 even on 64-bit systems.

PostgreSQL used MAX_KILOBYTES = INT_MAX/1024 when SIZEOF_LONG <= 4,
resulting in the 2GB limit. This was fixed in PostgreSQL 18 by removing
the SIZEOF_LONG check, increasing the limit to 2TB.

Changes:
- Add WindowsMaxWorkMem constant (2097151 KB)
- Apply limit in computeOS() for Windows + PostgreSQL < 18.0
- Add comprehensive tests including PostgreSQL 18+ cases
- Update rules.yml with version-specific limitation and fix reference

Tests verify:
- work_mem/maintenance_work_mem capped at ~2GB on Windows PG ≤ 17
- No limitations on Windows PG 18+
- No limitations on Linux/Unix platforms
- Correct behavior with high RAM (256GB, 1TB) scenarios

References:
- PostgreSQL 18 fix: https://www.postgresql.org/message-id/flat/1a01f0-66ec2d80-3b-68487680@27595217
- pgvector issue: pgvector/pgvector#667
- CommitFest patch: https://commitfest.postgresql.org/patch/5343/

Closes #5

Signed-off-by: Sebastian Webber <sebastian@swebber.me>
Improve readability and highlight critical information using
GitHub-style alert blocks (NOTE, TIP, WARNING, IMPORTANT). Convert
formulas to code blocks, add backticks to parameters/commands, and
reorganize recommendations for better discoverability.

Makes warnings about OOM risks, Windows limits, and security
practices more prominent and scannable.

Signed-off-by: Sebastian Webber <sebastian@swebber.me>
@sebastianwebber sebastianwebber merged commit c388bb1 into main Feb 5, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant