Solved

(where) is a field of type text

Posted on 2014-12-23
5
124 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 47

Expert Comment

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

Accepted Solution

by:
Gerwin Jansen, EE MVE 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:Scott Pletcher
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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

810 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