[MDEV-5795] Full-Column Unique Index Created: 2014-03-05 Updated: 2014-03-06 Resolved: 2014-03-05 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | None |
| Fix Version/s: | None |
| Type: | Task | Priority: | Major |
| Reporter: | BELUGABEHR | Assignee: | Unassigned |
| Resolution: | Duplicate | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||
| Description |
|
From the MySQL Manual:
Can you please implement a way to specify that uniqueness should extend beyond the prefix and apply to the entire column? Obviously the index could be used as a start, but any rows with matching prefix should be compared against the entire value. 1) Search the index Sure it would be a bit slower than index-only, but grant us the flexibility to decide full comparisons v.s. index and remove this limitation. Some practical examples: Thanks! |
| Comments |
| Comment by Sergei Golubchik [ 2014-03-05 ] |
|
You can have an index over the whole VARCHAR column if you don't specify the prefix length. |
| Comment by BELUGABEHR [ 2014-03-06 ] |
So it is not so simple to say that "You can have an index over the whole VARCHAR column." Again, I refer to the examples I posted. Uniqueness cannot be applied to long URLs in VARCHAR fields because of this limitation. I would simply suggest that the implementation for enforcing uniqueness be definite. The solution that I posted could be one way. Use a prefix index for a given storage engine and when collisions do occur in the index, do a serial search for a literal match. |
| Comment by Sergei Golubchik [ 2014-03-06 ] |
|
You're right. The limitation of 767 bytes applies to indexes over VARCHAR too. |