Solved

(where) is a field of type text

Posted on 2014-12-23
5
122 Views
Last Modified: 2014-12-26
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
Comment
Question by:enrique_aeo
5 Comments
 
LVL 65

Assisted Solution

by:Jim Horn
Jim Horn earned 250 total points
ID: 40515503
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
 
LVL 45

Expert Comment

by:Vitor Montalvão
ID: 40516099
Give us an example, please.
0
 
LVL 37

Accepted Solution

by:
Gerwin Jansen earned 250 total points
ID: 40516296
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
 
LVL 69

Expert Comment

by:ScottPletcher
ID: 40516676
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 Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now