• peter-757102 (1/13/2010)


    Note that indexes can only have a limited width (300 bytes or so , I believe).

    Because of this, it makes sense to do a reverse of only the last N characters and limit the length of the search text to match. If your strings have varying lengths between 3 and 250 characters and your search strings are strict enough with 12 characters, add a few extra and use the reverse of the rightmost 16 characters to put the index on and truncate the search string to 16 characters as well.

    This saves you a ton of otherwise unneeded duplicate data and keeps the number of page reads to a minimum.

    That's a great idea and a good refinement. I suppose you could also search on the last n characters which would potentially return you a list of primary keys from the table and then do a normal 'forwards' search on the resulting rows to narrow those down to the specifc results you want. The max index key size is 900 bytes BTW. See for details.

    Regards,

    Ben