Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimization Suggestion [CORE5683] #5949

Open
firebird-automations opened this issue Dec 18, 2017 · 1 comment
Open

Optimization Suggestion [CORE5683] #5949

firebird-automations opened this issue Dec 18, 2017 · 1 comment

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: Stefan Schmaltz (schlocke)

Votes: 1

We have a Database with UNICODE_CI and all varchar field have an Index.

So when executing
SELECT ...WHERE field='value' ... ORDER BY field

the result is fast

but when executing
SELECT ... WHERE UPPER(field)=UPPER('value') ... ORDER BY UPPER(field)

the result is very slow.

Suggestion: Case Insensitive Index should ignore UPPER (AND LOWER) because there is no difference

@firebird-automations
Copy link
Collaborator Author

Commented by: Omacht András (aomacht)

Hi Stefan!

1. Why don't you use: SELECT ... WHERE field=UPPER('value') ... ORDER BY field, if you store uppered values in fields...
or
2. Use computed index:
CREATE INDEX INDEX_NAME ON TABLE COMPUTED BY (UPPER(FIELD))
and then
SELECT ... WHERE UPPER(field)=UPPER('value') ... ORDER BY UPPER(field)
works fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant