34,838
社区成员




IF OBJECT_ID (N'StormyWeather', N'U') IS NOT NULL
DROP TABLE StormyWeather
GO
CREATE TABLE StormyWeather (
StormID INT NOT NULL IDENTITY,
StormHead NVARCHAR(50) NOT NULL,
StormBody NVARCHAR(MAX) NOT NULL,
)
GO
INSERT INTO StormyWeather (StormHead, StormBody)
VALUES('Stormy Weather Delays Travel',
'The stormy weather made travel by motor vehicle difficult.')
INSERT INTO StormyWeather (StormHead, StormBody)
VALUES('Stormier Weather on Monday',
'The stormier weather on Monday made vehicle travel difficult.')
INSERT INTO StormyWeather (StormHead, StormBody)
VALUES('Stormiest Weather in December',
'December can be the stormiest month, making automobile travel difficult.')
INSERT INTO StormyWeather (StormHead, StormBody)
VALUES('Storm Grows Strong',
'The storm is growing strong.')
INSERT INTO StormyWeather (StormHead, StormBody)
VALUES('Storms Crossing the Pacific',
'The storms are lining up across the Pacific Ocean.')
INSERT INTO StormyWeather (StormHead, StormBody)
VALUES('Storm''s Wind Delays Travel',
'The storm''s wind made car travel difficult on Tuesday.')
INSERT INTO StormyWeather (StormHead, StormBody)
VALUES('Storms'' Flooding Delays Travel',
'The storms'' flooding made auto travel difficult throughout December.')
INSERT INTO StormyWeather (StormHead, StormBody)
VALUES('Children Run from Room',
'The children often storm out of the room when upset.')
INSERT INTO StormyWeather (StormHead, StormBody)
VALUES('Boy Runs from Room',
'The boy storms out of the room when his sister changes the channel.')
INSERT INTO StormyWeather (StormHead, StormBody)
VALUES('Girl Ran from Room',
'The girl stormed out of the room when her brother ate the cookie.')
INSERT INTO StormyWeather (StormHead, StormBody)
VALUES('Children Running from Room',
'The children were storming out of the room when the lights went out.')
GO
create table #1 (
StormID INT NOT NULL IDENTITY,
StormHead NVARCHAR(50) NOT NULL,
StormBody NVARCHAR(MAX) NOT NULL,
)
go
INSERT INTO #1 (StormHead, StormBody)
VALUES('Boy Runs from Room',
'The boy storms out of the room when his sister changes the channel.')
INSERT INTO #1 (StormHead, StormBody)
VALUES('Girl Ran from Room',
'The girl stormed out of the room when her brother ate the cookie.')
INSERT INTO #1 (StormHead, StormBody)
VALUES('Children Running from Room',
'The children were storming out of the room when the lights went out.')
我的问题是如何提高如下链接的join顺序
select * from StormyWeather a join #1 b on a.StormBody = b.StormBody
需要补充的是
1. nvarchar(max)类型上 没办法加索引,
2.使用全文索引的话,好像没法支持 join操作
3.数据量是千万级或更高,单个表的大小目前大约10G,
4.这个查询只是个例子,用的最多的是在存储过程中,往表中插入此表没有的数据,其中判断条件中有这种大的列。
多谢多谢。。。
\\tas\WBLUE\Common\Screenshots\FT\SCS\SKY\W6M3\Localization\7025.1007\int\5001\lb-LU\IE100\FileCloud_SharingGetALinkShortenedUrl.cap -834524379
\\tas\WBLUE\Common\Screenshots\FT\SCS\SKY\W6M3\Localization\7025.1007\int\5001\lb-LU\IE100\FileCloud_SharingGetALinkShortenedUrl.cap -834524379
\\tas\WBLUE\Common\Screenshots\FT\SCS\SKY\W6M3\Localization\7025.1007\int\5001\lb-LU\IE100\FileCloud_SharingGetALinkShortenedUrl.cap -834524379
\\tas\WBLUE\Common\Screenshots\FT\MSA\LiveIDWeb\W6M3\Localization\10.10.2013\Onebox\sr-Cyrl-CS\TFAUX_TFA_SwitchProofPage_SendSMS_OptIn_Snapped_Win8Wiz.cap -834524379
\\tas\WBLUE\Common\Screenshots\FT\MSA\LiveIDWeb\W6M3\Localization\10.10.2013\Onebox\sr-Cyrl-CS\TFAUX_TFA_SwitchProofPage_SendSMS_OptIn_Snapped_Win8Wiz.cap -834524379
\\tas\WBLUE\Common\Screenshots\FT\MSA\LiveIDWeb\W6M3\Localization\10.10.2013\Onebox\sr-Cyrl-CS\TFAUX_TFA_SwitchProofPage_SendSMS_OptIn_Snapped_Win8Wiz.cap -834524379
\\tas\WBLUE\Common\Screenshots\FT\MSA\LiveIDWeb\W6M3\Localization\10.10.2013\Onebox\sr-Cyrl-CS\TFAUX_TFA_SwitchProofPage_SendSMS_OptIn_Snapped_Win8Wiz.cap -834524379
\\tas\WBLUE\Common\Screenshots\FT\SCS\SKY\W6M3\Localization\7025.1007\int\5001\lb-LU\IE100\FileCloud_SharingGetALinkShortenedUrl.cap -834524379
\\tas\WBLUE\Common\Screenshots\FT\SCS\SKY\W6M3\Localization\7024.1011\int\5001\pl-PL\IE100\OfficeCloud_BinaryConversionRetryableError.cap 1136973003
\\tas\WBLUE\Common\Screenshots\FT\SCS\SKY\W6M3\Localization\7108.1015\int\5001\gd-GB\IE100\OfficeCloud_GroupLeaveOptionsConfirmationDialog.cap 1136973003
\\tas\WBLUE\Common\Screenshots\FT\SP\FamilySafetyWeb\W6M1\Localization\10.23.2013\BVT\1\ig-NG\IE100\Email_ActivityReport9_Scroll_2.jpg 1938175911
\\tas\WBLUE\Common\Screenshots\FT\SP\FamilySafetyWeb\W6M1\Localization\10.23.2013\BVT\1\ig-NG\IE100\Email_ActivityReport7_Scroll_1.jpg 1938175911
注:不同的数据库,不同的表结构或者表大小的不同都可能影响checksum的值。
从上面可以看出,虽然filepath不同但 计算出的checksum值可能相同,
所以不能用checksum做验证方法。
IF OBJECT_ID (N'StormyWeather', N'U') IS NOT NULL
DROP TABLE StormyWeather
GO
CREATE TABLE StormyWeather (
StormID INT NOT NULL IDENTITY,
StormHead NVARCHAR(50) NOT NULL,
StormBody NVARCHAR(MAX) NOT NULL,
)
GO
INSERT INTO StormyWeather (StormHead, StormBody)
VALUES('Stormy Weather Delays Travel',
'The stormy weather made travel by motor vehicle difficult.')
INSERT INTO StormyWeather (StormHead, StormBody)
VALUES('Stormier Weather on Monday',
'The stormier weather on Monday made vehicle travel difficult.')
INSERT INTO StormyWeather (StormHead, StormBody)
VALUES('Stormiest Weather in December',
'December can be the stormiest month, making automobile travel difficult.')
INSERT INTO StormyWeather (StormHead, StormBody)
VALUES('Storm Grows Strong',
'The storm is growing strong.')
INSERT INTO StormyWeather (StormHead, StormBody)
VALUES('Storms Crossing the Pacific',
'The storms are lining up across the Pacific Ocean.')
INSERT INTO StormyWeather (StormHead, StormBody)
VALUES('Storm''s Wind Delays Travel',
'The storm''s wind made car travel difficult on Tuesday.')
INSERT INTO StormyWeather (StormHead, StormBody)
VALUES('Storms'' Flooding Delays Travel',
'The storms'' flooding made auto travel difficult throughout December.')
INSERT INTO StormyWeather (StormHead, StormBody)
VALUES('Children Run from Room',
'The children often storm out of the room when upset.')
INSERT INTO StormyWeather (StormHead, StormBody)
VALUES('Boy Runs from Room',
'The boy storms out of the room when his sister changes the channel.')
INSERT INTO StormyWeather (StormHead, StormBody)
VALUES('Girl Ran from Room',
'The girl stormed out of the room when her brother ate the cookie.')
INSERT INTO StormyWeather (StormHead, StormBody)
VALUES('Children Running from Room',
'The children were storming out of the room when the lights went out.')
GO
create table #1 (
StormID INT NOT NULL IDENTITY,
StormHead NVARCHAR(50) NOT NULL,
StormBody NVARCHAR(MAX) NOT NULL,
)
go
INSERT INTO #1 (StormHead, StormBody)
VALUES('Boy Runs from Room',
'The boy storms out of the room when his sister changes the channel.')
INSERT INTO #1 (StormHead, StormBody)
VALUES('Girl Ran from Room',
'The girl stormed out of the room when her brother ate the cookie.')
INSERT INTO #1 (StormHead, StormBody)
VALUES('Children Running from Room',
'The children were storming out of the room when the lights went out.')
go
--用checksum计算一个值
select CHECKSUM(StormBody)
from StormyWeather
/*
(无列名)
318284405
-1996609556
-957497181
942488834
-1966874030
1290197037
613467569
706926295
-1408726896
1805667295
136736880
*/