Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

djberg96 (2603)

  (email not shown publicly)

Journal of djberg96 (2603)

Tuesday July 20, 2004
10:12 AM

Functional indexes

[ #19949 ]
You know a book is good when you find yourself saying, "Oh, cool!" often. Today was another one from Guy's book.

Let's say you've got a web form that lets people search on a field in a database, and you want to allow folks to search in a case insensitive way. You could use UPPER(), but then you would lose any benefit of an index on that column. So, how do you deal with this?

Answer: create a functional index, which is simply an index that can include functions within their definition, e.g.

create_index index_foo on bar
(upper(some_column_a), upper(some_column_b))

With that you can still use upper and retain the benefit of the index.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.