query

  • Interview Question

    Select * from Employee

    when F5 press(when the Above query executes) what happens internally?

  • as I understand it:

    First, the query will be parsed.

    Then, it is sent to the Query Optimiser, which generates the execution plan.

    The plan is then used to return the data requested

    ------------------------------------------------------------------------
    Bite-sized fiction (with added teeth) [/url]

  • That covers the bare bones basics. You might pick up a copy of TSQL-Querying by Itzik Ben Gan for more. Also SQL Server Internals by Kalen Delaney is a must.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • My answer would be that the DBA chases you with a well equipped pork chop launcher until your heals smoke because you selected too much data. 😉

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Tell him "it depends". Ask him if DBCC FREEPROCCACHE or DBCC DROPCLEANBUFFERS has been executed first, and then follow up with the parse, optimize, etc. steps answer. You can also give him the order of execution as well. I can say that I've never had to answer (and have never asked) a question such as this...sorta klugey

  • ab5sr (3/21/2009)


    Tell him "it depends". Ask him if DBCC FREEPROCCACHE or DBCC DROPCLEANBUFFERS has been executed first, and then follow up with the parse, optimize, etc. steps answer. You can also give him the order of execution as well. I can say that I've never had to answer (and have never asked) a question such as this...sorta klugey

    I agree... for most folks, the question would qualify as a "ring knocker's" question. It's one of those questions where the interviewer is more concerned about showing what (s)he knows about something (usually, just oolies that no one else would ever worry about) than actually finding out if the person being interviewed can actually do the job.

    When folks doing the interviewing ask such questions, it's usually a pretty good sign that you don't really want to work with them, anyway.

    Now, ask what a Tally or Numbers table can be used for, how to do a conditional execution path in DTS, two ways to get a listing of file names in a directory without using xp_CmdShell, or one of the easiest ways to optimize an aggregated query with a ten table join, and that's the kind of folks you want to work with.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply