Re: Table with Text values
Posted by: Rick James
Date: December 18, 2015 05:34PM

Plan A:
* foo VARCHAR(128)
* UNIQUE(foo)
Yes, the index is bulkier, but that is not a big deal.
Note that Plan A is the simplest for you. (I think that matters.)
Only works if foo is under 767 bytes.

Plan B:
* hash BINARY(20), foo VARCHAR(128)/TEXT/VARCHAR(500)/...
* UNIQUE(hash)
This "works", and, hence, may be necessary in some situations (>767).
But it takes more code. And it is a 'random' index, which does not scale well.

Plan C:
* hash INT UNSIGNED, foo ...
* INDEX(hash)
32-bits is not enough to assure UNIQUEness.
You need (hash = ... AND foo = ...)

I like Plan A. Now that you have all(?) the relevant info, you can make your own choice.

Options: ReplyQuote


Subject
Written By
Posted
December 13, 2015 09:28AM
December 13, 2015 10:44AM
December 14, 2015 01:05AM
December 14, 2015 08:02AM
December 16, 2015 10:25PM
December 16, 2015 10:27PM
December 17, 2015 03:53AM
December 17, 2015 01:00PM
December 17, 2015 03:52PM
Re: Table with Text values
December 18, 2015 05:34PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.