Jump to content

sql nerchukundam randiii... Ms sql server technology discussions...


mtkr

Recommended Posts

Just now, k2s said:

antey endo seppochu kada man 

imp un-imp antey saripothunda 

endi daddy pillalni ala rape chestunnav.. is this good for a aged person like u man...

Link to comment
Share on other sites

1 minute ago, mtkr said:

avi ekkado copy kotti raasukunnaviii...

guruvu +_(

               loveindia

vinadaaniki idi chaala baagundi man.. keep it coming man...  tJ3Nth3.gif

Link to comment
Share on other sites

34 minutes ago, k2s said:

qochens sir 

1) what is difference between Table/Index Scan vs Seek ? How SQL server evaluate(search row) in each case ? 

2) Create Index on filtered, aggregated col,  antey ela chestharu ? oka table lo index ni ela create chestharu ?

3) Join ki correlated sub query ki difference enti ? how does SQL server evaluate in each case ? why join is preferred ?

@loveindia @mtkr help ??

Link to comment
Share on other sites

23 minutes ago, k2s said:

qochens sir 

1) what is difference between Table/Index Scan vs Seek ? How SQL server evaluate(search row) in each case ? 

2) Create Index on filtered, aggregated col,  antey ela chestharu ? oka table lo index ni ela create chestharu ?

3) Join ki correlated sub query ki difference enti ? how does SQL server evaluate in each case ? why join is preferred ?

1) Index scan is looking all data pages from first to last... index seek is looking specific data pages...

scan preferred whn tbl is small..

seek preferred whn tbl is large...

orders table having no index on it
select * from orders --- table scan

orders table having clustered index on it
select * from orders --- index scan

orders table having clustered index on it
select * from orders where id = 2 --- index seek

https://blogs.msdn.microsoft.com/craigfr/2006/06/26/scans-vs-seeks/

 

2) create index index_name on table_name (column_name)

 

3) correlated sub query -  its a subquery wch uses values from outer query for execution 

(frm ggle)

A correlated subquery is one which uses values from the parent query. This kind of query tends to run row-by-row, once for each row returned by the outer query, and thus decreases SQL query performance. New developers are often caught structuring their queries in this way—because it’s usually the easy route.

Here’s an example of a correlated subquery:

SELECT c.Name, 
       c.City,
       (SELECT CompanyName FROM Company WHERE ID = c.CompanyID) AS CompanyName 
FROM Customer c
In particular, the problem is that the inner query (SELECT CompanyName…) is run for each row returned by the outer query (SELECT c.Name…). But why go over the Company again and again for every row processed by the outer query?

A more efficient performance tuning technique would be to refactor the correlated subquery as a join:

SELECT c.Name, 
       c.City, 
       co.CompanyName 
FROM Customer c 
    LEFT JOIN Company co
        ON c.CompanyID = co.CompanyID
In this case, we go over the Company table just once, at the start, and JOIN it with the Customer table. From then on, we can select the values we need (co.CompanyName) more efficiently.

  • Upvote 1
Link to comment
Share on other sites

Why can't you build non clustered indexes on all the columns provided you have good CPU performance (wipro interveiw question)

SSIS vi post chestha next... 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...