Created
September 14, 2012 18:54
-
-
Save frankwiles/3723916 to your computer and use it in GitHub Desktop.
Index on first 5 characters of a column
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE song ( | |
title varchar(20), | |
); | |
CREATE INDEX firstfive_idx ON song WHERE substring(title, 0, 6); | |
SELECT * FROM song WHERE substring(title, 0, 6) = 'foobar1' AND title='foobar1bazbazwheeheee!'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment