There are a million records in table.
How to speed up query, it takes two 3mins to process this one query.
ALTER PROCEDURE [dbo].[prc_GetDistinctConcatStringColorUnitsOnly]
AS
BEGIN
IF OBJECT_ID ('dbo.CONCAT_COLOR_UNITS_ONLY', 'U') IS NOT NULL
DROP TABLE dbo.CONCAT_COLOR_UNITS_ONLY;
select distinct ([COLOR].[TEST_SET_IDENTIFICATION] + ' ' +
[COLOR].[IDENTIFICATION] + ' ' +
[COLOR].[SERIAL_NUMBER] + ' ' +
[COLOR].[PART_NUMBER] + ' ' +
[COLOR].[CODE]) AS CONCAT, *
into dbo.CONCAT_COLOR_UNITS_ONLY
FROM dbo.COLOR
where SERIAL_NUMBER not like ('%[^0123456789]]%' )and LEN(SERIAL_NUMBER)= 6 and SERIAL_NUMBER NOT LIKE '%[A-Z]%' and COLOR_CATEGORY not like 'RED'
END
Loading
Jignesh TrivediPosted Feb 22, 2012, 10:21 PM
below are good articles..
http://blog.sqlauthority.com/2008/09/05/sql-server-creating-full-text-catalog-and-index/
http://www.sql-server-performance.com/2010/full-text-search-2008/
http://www.codeproject.com/Articles/29237/SQL-SERVER-2008-Creating-Full-Text-Catalog-and-Ful
hope this help.
David SmithPosted Feb 22, 2012, 7:40 AM
Jignesh TrivediPosted Feb 22, 2012, 6:09 AM
Full text indexing/search if you have leading wildcards.
i.e. Create full text indexing on SERIAL_NUMBER and COLOR_CATEGORY fields.
not use inbuild function like LEN in where condition
Also not use "Not Like" in Where condition.
Please refer.
http://msdn.microsoft.com/en-us/library/ms172984.aspx
hope this help.