Open dlakata opened 1 year ago
The latest updates on your projects. Learn more about Vercel for Git ↗︎
Name | Status | Preview | Comments | Updated (UTC) |
---|---|---|---|---|
downforacross.com | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | Jul 2, 2023 11:04pm |
Hey thanks for helping out with this! A few comments:
Otherwise, the code change looks great!
Could we make the constraint only apply to public puzzles? Unlisted puzzles should allow duplicates
I think the WHERE pid > '30000' AND is_public
clause should handle this: https://www.postgresql.org/docs/current/indexes-partial.html
do we need to materialize the md5 hashes in db (and add an index on it) as an optimization? I'm not too familiar w/ using md5 but this looks like an unindexed query that could get pretty slow...
I think CREATE UNIQUE INDEX unique_puzzle_content
should add the index, which the Index Scan using unique_puzzle_test_content
test in the description used. Based on https://www.postgresql.org/docs/7.3/indexes-functional.html, I think we don't need to materialize, and postgres will store the index results. But I'm new to functional indexes, so you should verify my understanding!
For #139 and #15
You'll need to create the index for this to take effect. I chose
30000
as the minimumpid
to avoid enforcing unique constraints on existing data, and it appears to be an ID that'll be reached in the next week or two.I created another table locally called
puzzles_test
and verified that the index seems to be used: