Click here to Skip to main content
15,906,645 members
Home / Discussions / Database
   

Database

 
AnswerRe: retiveig columns Pin
Krish - KP13-Apr-07 1:59
Krish - KP13-Apr-07 1:59 
GeneralRe: retiveig columns Pin
yuvachandra13-Apr-07 2:48
yuvachandra13-Apr-07 2:48 
GeneralRe: retiveig columns Pin
Krish - KP16-Apr-07 22:25
Krish - KP16-Apr-07 22:25 
QuestionRead a portion of flat file - SSIS Pin
amnaahmad12-Apr-07 21:15
amnaahmad12-Apr-07 21:15 
Questionsql query for number days in a month & number of sundays in a month... Pin
Member 387988112-Apr-07 20:47
Member 387988112-Apr-07 20:47 
AnswerRe: sql query for number days in a month & number of sundays in a month... Pin
Krish - KP13-Apr-07 2:05
Krish - KP13-Apr-07 2:05 
Questionneed a query in microsoft sql server Pin
Revathi Raj12-Apr-07 20:13
Revathi Raj12-Apr-07 20:13 
AnswerRe: need a query in microsoft sql server Pin
Krish - KP12-Apr-07 21:34
Krish - KP12-Apr-07 21:34 
Questionretrieve all database names Pin
yuvachandra12-Apr-07 18:44
yuvachandra12-Apr-07 18:44 
AnswerRe: retrieve all database names Pin
Krish - KP12-Apr-07 20:14
Krish - KP12-Apr-07 20:14 
GeneralRe: retrieve all database names Pin
yuvachandra12-Apr-07 21:33
yuvachandra12-Apr-07 21:33 
GeneralRe: retrieve all database names Pin
Krish - KP12-Apr-07 21:39
Krish - KP12-Apr-07 21:39 
GeneralRe: retrieve all database names Pin
yuvachandra12-Apr-07 22:41
yuvachandra12-Apr-07 22:41 
QuestionHelp on SQL Crosstab query (VERY SLOW) Pin
Chandman12-Apr-07 6:44
Chandman12-Apr-07 6:44 
AnswerRe: Help on SQL Crosstab query (VERY SLOW) Pin
Pete O'Hanlon12-Apr-07 9:27
mvePete O'Hanlon12-Apr-07 9:27 
AnswerRe: Help on SQL Crosstab query (VERY SLOW) Pin
DQNOK12-Apr-07 9:58
professionalDQNOK12-Apr-07 9:58 
GeneralRe: Help on SQL Crosstab query (VERY SLOW) [modified] Pin
Chandman12-Apr-07 12:19
Chandman12-Apr-07 12:19 
GeneralRe: Help on SQL Crosstab query (VERY SLOW) Pin
DQNOK12-Apr-07 12:30
professionalDQNOK12-Apr-07 12:30 
GeneralRe: Help on SQL Crosstab query (VERY SLOW) Pin
Chandman12-Apr-07 13:22
Chandman12-Apr-07 13:22 
GeneralRe: Help on SQL Crosstab query (VERY SLOW) Pin
Pete O'Hanlon13-Apr-07 1:45
mvePete O'Hanlon13-Apr-07 1:45 
GeneralRe: Help on SQL Crosstab query (VERY SLOW) Pin
Chandman13-Apr-07 8:18
Chandman13-Apr-07 8:18 
GeneralRe: Help on SQL Crosstab query (VERY SLOW) Pin
Pete O'Hanlon13-Apr-07 9:58
mvePete O'Hanlon13-Apr-07 9:58 
GeneralRe: Help on SQL Crosstab query (VERY SLOW) [modified] Pin
DQNOK13-Apr-07 7:13
professionalDQNOK13-Apr-07 7:13 
GeneralRe: Help on SQL Crosstab query (VERY SLOW) Pin
Chandman13-Apr-07 8:10
Chandman13-Apr-07 8:10 
Thank you for you effort on this. You've spend lot of time on this.
I have lot of JOINs and conditions within each sub SELECT query. how many rows did you add to Tests?

When I run my query on a smaller scale (ex: Just Toyotas years 2000-2006) it works fine (max 1 minute wait). When I do something like all SUV's then it goes more than 3 minutes and nobody wants to wait for that long.

Thank you for everyone who tried to help! And here's my conclusion:

DO NOT RUN a CROSSTAB query like this if you have complex database and each table has thousands and thousands of rows and especially if one of the tables has more than 1 million rows. This kind of cross tabbing in MS SQL just WILL NOT WORK (fast enough)! I don't know about other database engines but it seems like the engine SHOULD optimize it for you because compilers such as modern C++ compilers optimize codes. In and IDEAL database engine using this CROSSTAB example it should break down the years into threads and run them seperately - it saves lot of times.
WHY? BECAUSE when I do this query using separately (dividing into smaller pieces by years) and if I run it it takes 10 seconds. Then I build the 2D table out of all this sub queries using any programming language - it takes another 10-20 seconds. So I'm going back to my old method.

It also brings up another question:
Can you do threads in MS SQL query and do some sort of wait on those? I figured it should do it in the background because all it takes is one semester worth of class with a project. I mean, the Microsoft operating systems are capable of doing threads (so it runs), so why they shouldn't integrate it into the SQL server? It's not a rocket science!

CORRECT ME IF I'M WRONG. I COULD BE!!!
GeneralRe: Help on SQL Crosstab query (VERY SLOW) Pin
DQNOK13-Apr-07 8:30
professionalDQNOK13-Apr-07 8:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.