Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 157
  • Last Modified:

(where) is a field of type text

experts,
is there any way to optimize a single query; but whose condition (where) is a field of type text, for being such a field can not create indexes and as the field is so large, it takes a lot a simple query.
0
enrique_aeo
Asked:
enrique_aeo
2 Solutions
 
Jim HornMicrosoft SQL Server Developer, Architect, and AuthorCommented:
Shows us your query, and some sample WHERE conditions.
Indexes can be created on text fields, but it is not considered a best practice due to the larger size of text data types compared to numeric.
0
 
Vitor MontalvãoMSSQL Senior EngineerCommented:
Give us an example, please.
0
 
Gerwin Jansen, EE MVETopic Advisor Commented:
Creating one or more extra columns that contain a substring of what you want to search for (where) is a possibility. Create an index on the extra columns, upon inserting add the substring(s) to the extra columns. Will cost you some storage and performance on inserting, so depending on your data, amount of inserts/queries you will get better performance.
0
 
Scott PletcherSenior DBACommented:
If there are "canned" searches, you could also pre-compute flags and then simply check the flags.

Specifically which version of SQL, 2005 or 2008 or other?  There are indexing differences between/among the versions.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now