Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
dhvani2511
Starting Member
1 Post |
Posted - 2009-01-29 : 08:11:16
|
| hi all i have around 2 lakh records 4 tables eachi wants to join them in select querybut sql takes many many much time for itis there any other way to do this or it is a limitation of sql??? Its UrgentThanksdhvani |
|
|
raky
Aged Yak Warrior
767 Posts |
Posted - 2009-01-29 : 08:18:42
|
| Hi,try thiscreate the query by joining the tables and insert the output of query into a table variable and create index on joining columns in table variable and select from that table variable.... |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2009-01-29 : 08:19:53
|
Limit the resultset by writing proper WHERE clauses.And having 4 tables with 200,000 records each is not much. E 12°55'05.63"N 56°04'39.26" |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2009-01-29 : 08:20:49
|
quote: Originally posted by raky create the query by joining the tables and insert the output of query into a table variable and create index on joining columns in table variable and select from that table variable....
Raky, how do you create index on a table variable, other than PRIMARY KEY in the declarative part? E 12°55'05.63"N 56°04'39.26" |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2009-01-29 : 08:21:33
|
quote: Originally posted by dhvani2511 Its Urgent
Post your query here and some explanation for what you are trying to accomplish. E 12°55'05.63"N 56°04'39.26" |
 |
|
|
raky
Aged Yak Warrior
767 Posts |
Posted - 2009-01-29 : 08:22:05
|
quote: Originally posted by Peso
quote: Originally posted by raky create the query by joining the tables and insert the output of query into a table variable and create index on joining columns in table variable and select from that table variable....
Raky, how do you create index on a table variable, other than PRIMARY KEY in the declarative part? E 12°55'05.63"N 56°04'39.26"
sorry use temp table...instead of table variable |
 |
|
|
sodeep
Master Smack Fu Yak Hacker
7174 Posts |
Posted - 2009-01-29 : 09:38:34
|
quote: Originally posted by raky
quote: Originally posted by Peso
quote: Originally posted by raky create the query by joining the tables and insert the output of query into a table variable and create index on joining columns in table variable and select from that table variable....
Raky, how do you create index on a table variable, other than PRIMARY KEY in the declarative part? E 12°55'05.63"N 56°04'39.26"
sorry use temp table...instead of table variable
And this will increase the size of TempDB. Like Peso said,limit resultset with Where Clause and use index to speed it up. |
 |
|
|
|
|
|