parallel execution of CTAS statements

  • Hi,

    I have 10 CTAS statements creating temp tables. Once they are created, they are LEFT OUTER JOINED.

    Is there a way, a parallel execution of these 10 CTAS statements be enforced programmatically or does the Query optimiser engine take care of this automatically?

    thank you

  • etl2016 (2/9/2016)


    Hi,

    I have 10 CTAS statements creating temp tables. Once they are created, they are LEFT OUTER JOINED.

    Is there a way, a parallel execution of these 10 CTAS statements be enforced programmatically or does the Query optimiser engine take care of this automatically?

    thank you

    What are CTAS?

    The absence of evidence is not evidence of absence
    - Martin Rees
    The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
    - Phil Parkin

  • hi, CTAS is create table as SELECT

    thank you

  • etl2016 (2/9/2016)


    hi, CTAS is create table as SELECT

    thank you

    The simplest way I can think of doing this is using an SSIS package to submit the queries in parallel via multiple ExecuteSQL tasks.

    The absence of evidence is not evidence of absence
    - Martin Rees
    The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
    - Phil Parkin

  • That sounds like Oracle not SQL Server. SS doesn't have CTAS syntax.

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • ScottPletcher (2/9/2016)


    That sounds like Oracle not SQL Server. SS doesn't have CTAS syntax.

    Aha, I just assumed it was an unorthodox way of referring to SELECT INTO.

    The absence of evidence is not evidence of absence
    - Martin Rees
    The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
    - Phil Parkin

  • ScottPletcher (2/9/2016)


    That sounds like Oracle not SQL Server. SS doesn't have CTAS syntax.

    It's SQL Server Parallel Data Warehouse aka APS, or the Azure version of it, Azure DWH. CTAS replaces SELECT ... INTO in the PDW.

    PDW is not a standard SQL Server, SSIS is not a good option for working on data within the PDW, because it doesn't take advantage of the distributed nature of the data, and it requires pulling the data out and putting it back in.

    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
  • etl2016 (2/9/2016)


    Is there a way, a parallel execution of these 10 CTAS statements be enforced programmatically or does the Query optimiser engine take care of this automatically?

    The CTAS statements will be executed one after each other. T-SQL is synchronous in terms of statement execution. Each one may run in parallel depending on the distribution of the data.

    The only way to make the CTAS statements run at the same time as each other would be multiple sessions each with one or more of the CTAS statements, but then you risk running into the concurrent query limit.

    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
  • GilaMonster (2/9/2016)


    The CTAS statements will be executed one after each other. T-SQL is synchronous in terms of statement execution. Each one may run in parallel depending on the distribution of the data.

    CTAS needs to apply exclusive locks on system objects.

    While the first one is not finished no other ones would be able to start.

    _____________
    Code for TallyGenerator

Viewing 10 posts - 1 through 9 (of 9 total)

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