_ | 覦覈襦 | 豕蠏手 | 殊螳 | 譯殊碁
FrontPage › 2螳30覿螳曙
Data Analysis(R)
Data Analysis(Python)
Statistics
Data Warehouse
Database System
SQL Server
Impala
Hive
Hadoop

Working Smart
Blog
Philosophy
Link
Miscellaneous
__ edit


蟯螻旧 覯 伎觜襦 一讌螻,
旧 蠍磯.
--覓語 貎朱Μ
select *
from A inner join B
on A.id = B.id
where A.dt between @begin and @end
go

-- 800蟇
select count(*) from A where A.dt between @begin and @end

--20000000蟇
select count(*) from B

A.id 碁煙
B.id 碁煙 .
譟磯 譬..譴覲給 id螳 2螳 蟾 襷蟾..

蠏朱..10豐螳 讌..1覿 讌 5覿 讌 讌 ..
覦..襾手螳 覈視..
螳 一危壱 危エ覲企..

A.id varchar(12)
B.id nvarchar(12)..
ろ碁~

select *
from A inner join B
on convert(nvarchar(12), A.id) = B.id
where A.dt between @begin and @end
go

<;;;
蠏碁 蟆郁骸螳 ..
碁 螳 讌 企 蟆郁骸 螳..
ろ螻 襷企...
蠏碁蟆 2螳 30覿 ..

cross apply襯 企蓋..

select *
from A cross apply (select * from B where A.id = B.id) b
where A.dt between @begin and @end
go


...覓企 index seek 蠍覿.. top 1 譴覲伎..


select *
from A cross apply (select top 1 * from B where A.id = B.id) b
where A.dt between @begin and @end
go

蟆郁記 螳 り 願屋 朱.. i/o螳 譬 襷..
譟碁 谿谿..

豌朱 襷朱 れ ..
!!!! 觚..觚..觚..觚..觚..

A.id nvarchar(12)
B.id varchar(12)..

A企 覲伎 B企 覲企ゼ り碁!!!

select *
from A inner join B
on convert(varchar(12), A.id) = B.id
where A.dt between @begin and @endgo

蠍磯Μ..譟磯.. 譯朱 願啓 覈詩螻 願 覘..
蠍 蠍郁鍵..
企: : るジ讓曙 襦螻豺 企Ν 譯殊語. 襦螻豺
EditText : Print : Mobile : FindPage : DeletePage : LikePages : Powered by MoniWiki : Last modified 2018-04-13 23:12:54Anonymous