SPID related question

  • Is it possible for an application to run 2 queries at the same time (ie: 2 threads) using the same SPID?

    I work with TSQL mostly and have few programming skills, but the problem I'm currently troubleshoot suggests that this happened.

    If more light is needed let me know.

    --
    Thiago Dantas
    @DantHimself

  • yes it is possible. Occasionally SQL server will find it necessary to spawn off a new thread if it thinks it will be more optimal.

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

  • I mean a third-party application creating a new thread using the same sql server SPID

    --
    Thiago Dantas
    @DantHimself

  • dant12 (5/7/2010)


    I mean a third-party application creating a new thread using the same sql server SPID

    For example you have a SQL Server process running on SPID 25 and the third party app tries to use 25 as well?

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

  • this is probably a parallel query.

    see if only one connection shows as runnable with the others suspended. A waittype of CXPACKET would confirm it.

    ---------------------------------------------------------------------

  • Ok, ill explain further

    We have a stored procedure that gathers information on incosistencies from the ETL process on a #temp table and exports a csv file via BCP

    each of the staging ETL tables have a CONTROL column which is used as a parameter to the procedure

    from the problem I am looking at it APPEARS that what happened was:

    Thread1 from the application: "exec usp_export 1"

    Thread2 from the application: "exec usp_export 2"

    the table created on each call is the same, #TEMP_INCON, but since it has the # the names should be unique per SPID

    the problem was: on the file created from the first call was data that must have come from the second call

    therefore my question remains, can both calls be executed at the same time, using the same SPID in a way that both EXECS use the same #TEMP table?

    --
    Thiago Dantas
    @DantHimself

  • MARS? Multiple Active Result Sets.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass

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

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