Skip to main content

All Questions

1 vote
2 answers
62 views

Sql Server: Query to parse and validate codes

We have a #ValidCode table with list of valid codes like: 'A', 'B', 'C', etc. Another table called #SourceData with input data -- that comes as a combination of valid and invalid tokens (sometimes ...
ToC's user avatar
  • 717
0 votes
2 answers
87 views

How to simplify this intersect query?

SELECT * from M left JOIN K on M.id = k.id left JOIN W on K.str = W.str where str = N'أخبار' INTERSECT SELECT * from M left JOIN K on m.id = k.id left JOIN W on K.str = W.str where str = N'فلسطين' ...
simpatico's user avatar
0 votes
0 answers
53 views

Azure SQL Database :: table size query takes forever to execute

I was working with the awesome Azure SQL Database Diagnostic Information Queries created by Glenn Berry and I realized that the query number 40 takes forever to execute: -- Get Schema names, Table ...
Francesco Mantovani's user avatar
-4 votes
2 answers
706 views

Calculate total_worker_time in minutes [closed]

I have an easy query which can show me the top 10 elapsed time by query_plan_hash and query_hash: PRINT '-- top 10 elapsed time by query_plan_hash and query_hash --' SELECT TOP 10 query_plan_hash ...
Francesco Mantovani's user avatar
0 votes
1 answer
2k views

Does a select within a where clause affect performance?

I know that we should avoid using functions in the where clause of a query wherever possible since the function will run for every row to return the proper results. However, does the same principle ...
Paradox's user avatar
  • 155
-1 votes
1 answer
360 views

How to enhance performance when compare two table feature value to run faster?

I work on sql server 2019 i face issue when compare feature values between two tables Based on RecomendationId . it take too long time to display result time that take it 5 minute . total rows on ...
ahmed barbary's user avatar
1 vote
1 answer
3k views

Query optimisation to remove nested loop

I have below query which is having high Sub-tree cost. I have created appropriate Indexes for for the query which are getting seek but, still the sub-tree cost in high. however, I can see nested Loop (...
Aditya's user avatar
  • 33
0 votes
1 answer
49 views

Inhibiting results to pane in SSMS (TSQL language) via script

I found that one could use a menu to "discard" results in SSMS (TSQL language). Please see: Original Question about inhibiting results and its answer. However, I was wondering if there is a ...
JosephDoggie's user avatar
8 votes
3 answers
3k views

Improper use of logical operators has led to poor query performance

I have a table with huge amount of data (Nearly 15 million) and below structure. create table test (a int,--> /* There is a normal index on this column */ b int, <other columns>) There is a ...
Pantea's user avatar
  • 1,510
3 votes
3 answers
2k views

Reducing Temp Table Scans when joining two temp tables using OR conditions

I'm working on a complicated query. I have up to this point been able to refactor to reduce execution time as well as number of scans and reads. At this point in the query, we have two temp tables ...
scarr030's user avatar
  • 115
1 vote
1 answer
3k views

Query to divide each column value to two categories: [Common , Not_Common]

I have a table with below structure and data: create table PTEST ( col_name VARCHAR(50), col_value VARCHAR(50) ) COL_NAME COL_VALUE ----------------------- first apple ...
Pantea's user avatar
  • 1,510
2 votes
1 answer
346 views

Forwarding records in #temp table

I have a temp table which I update many times based on joins (each time almost all the rows). I have kept it as a heap since if I don't get an inner loop join then after each update I get a sort in ...
xhr489's user avatar
  • 817
2 votes
3 answers
279 views

Query to update one column of a table based on a column of a different table

I have two tables with below structure : Create table Customer_info (Customer_num varchar(50), Customer_Branch int); Create table Customer_Transaction_Info (Customer_num varchar(50), ...
Pantea's user avatar
  • 1,510
0 votes
1 answer
32 views

Query specific key fields from x-number of tables?

I'm building an insurance database and I need some help with best practice on fast quering data. Let's say I have three insurance types ... Car, Home and Travel. Common for all three types, I have the ...
MojoDK's user avatar
  • 101
3 votes
1 answer
655 views

Query optimization issue on view with RANK on DateTime for most recent rows

I'm having a problem with a view, that is designed to store sync data, for an iOS app, that syncs data back and forth to a web service. The XML fields are used to store both structured data for ...
Rebecca's user avatar
  • 299

15 30 50 per page
1
2 3 4 5 6