Timeline for Optimize Postgres query for finding string collisions
Current License: CC BY-SA 4.0
5 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Oct 24 at 14:57 | comment | added | Erwin Brandstetter |
@Ruben: ('*', 'CHRISTMAS10') and ('acme', 'CHRISTMAS10') can co-exist with either of my multicolumn indices, which only enforce your requirements in part. (That's why we still need the sophisticated queries.) UNIQUE is really optional. But I would keep it as second layer of defense. I updated to clarify.
|
|
Oct 24 at 14:55 | history | edited | Erwin Brandstetter | CC BY-SA 4.0 |
clarify; add fiddle
|
Oct 24 at 12:17 | comment | added | Ruben |
Hi, the only issue I see with this is that workspace_id = '*', code = 'CHRISTMAS10' and workspace_id = 'acme', code = 'CHRISTMAS10' can't co-exist, so that's why that unique index might not be right. I might be optimizing for a case I shouldn't, but if I know that all my codes generated in a batch are of length x , I can already filter out all codes that are not length x , and that's the index I'd be looking for.
|
|
Oct 24 at 10:51 | history | edited | Erwin Brandstetter | CC BY-SA 4.0 |
format
|
Oct 24 at 7:53 | history | answered | Erwin Brandstetter | CC BY-SA 4.0 |