sql server - SQL query takes much time to execute -


I have a table candidates 43,437 rows with data, which are created by many employees

I want to get a report in which I want to get the personalized candidate of each employee in a period of 7 days .. I have performed the following queries for this. Select

  E, E.Employinaame, (Candidate Select from C to count (CID) where CRITID = E. ID and C. Sorted between convert (date time, 19/07 / 2014 ', 103) and Convert (date time, from '26 employees   

to E.ID employee's ID employee Table <.. / P>

but it takes about 2 minutes to execute the above query .. I do not index indexing in the candidate Did.

How to implement this query a few seconds ..?

Based on your description of the problem , The query should look like this:

  Select Maker_ID, count (CID) Candidate convert from C here (Datetime, 1 9/07/2014 ', 103) and Convert (Datetime, '26 Creator / ID   

(It believes that candidate.Creator_id and Employees.id Between are a foreign key relationship.)

for this query The best index is a cover index in which there are three columns outlined in the query:

  create idx_candidate_createddate_creator_id_id index on candidate (created_date, manufacturer_id, id);    

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -