ahmed elbarbary

ahmed elbarbary

  • NA
  • 1.6k
  • 281.3k

inner join give me huge data when package id equal package id from ano

Nov 29 2021 11:42 PM

I work on sql server 2014 i face issue when join two tables as inner join
from table package it have 100000 rows
and table package2 100000 rows
so it will give result as
100000 * 100000
and it take too much time
so how to handle that issue of big data
are there are any way to get data quickly

create table #package
 (
 packageId int,
 PartId int
 )
 insert into #package(packageId,PartId)
 values
 (1121,2311),
 (1121,9911),
 (1121,2020),
 (1121,5052),
 (1194,4311),
 (1194,9812),
 (1194,2391),
 (1194,5541)
    
    
 create table #package2
 (
 packageId int,
 PartId int
 )
 insert into #package2(packageId,PartId)
 values
 (1121,2377),
 (1121,2111),
 (1121,3420),
 (1121,5057),
 (1194,4388),
 (1194,9912),
 (1194,1091),
 (1194,6441)
    
 select p.partid as partc,p2.partid as partx  from #package p
 inner join #package2 p2 on p.packageId=p2.packageId

 


Answers (2)