Skip to main content
Tweeted twitter.com/StackDBAs/status/1073639050857406464
Clarified question and cleaned up wording
Source Link

How doesmany rows can SQL Server deal with millions of recordsprocess in a single INSERT statement into a table?

To illustrate my question, the following is a query detecting order's id which have not been inserted in a data warehouse and inserts them:

With NewOrders 
As
(   
    Select OrderID From Orders
    Except
    Select OrderID From FactOrders
)
Insert Into FactOrders(OrderID, OrderDate, CustomerId)
    Select OrderID, OrderDate, CustomerId From Orders
    Where OrderID in (Select OrderID from NewOrders);

Say the query is run for the first time and Orders contains 400 million rows or more:

  1. Can SQL Server handle this amount of rows? If not, how should I proceed? Should I limit the number of rows fetched in the insert statement?
  2. How many rows can be handled at once?

Can SQL Server handle this number of rows in one single INSERT statement?

If not, how should I proceed? Should I limit the number of rows fetched in the INSERT statement? How many rows can the engine handle in a single INSERT statement?

How does SQL Server deal with millions of records?

To illustrate my question, the following is a query detecting order's id which have not been inserted in a data warehouse and inserts them:

With NewOrders 
As
(   
    Select OrderID From Orders
    Except
    Select OrderID From FactOrders
)
Insert Into FactOrders(OrderID, OrderDate, CustomerId)
    Select OrderID, OrderDate, CustomerId From Orders
    Where OrderID in (Select OrderID from NewOrders);

Say the query is run for the first time and Orders contains 400 million rows or more:

  1. Can SQL Server handle this amount of rows? If not, how should I proceed? Should I limit the number of rows fetched in the insert statement?
  2. How many rows can be handled at once?

How many rows can SQL Server process in a single INSERT statement into a table?

To illustrate my question, the following is a query detecting order's id which have not been inserted in a data warehouse and inserts them:

With NewOrders 
As
(   
    Select OrderID From Orders
    Except
    Select OrderID From FactOrders
)
Insert Into FactOrders(OrderID, OrderDate, CustomerId)
    Select OrderID, OrderDate, CustomerId From Orders
    Where OrderID in (Select OrderID from NewOrders);

Say the query is run for the first time and Orders contains 400 million rows or more:

Can SQL Server handle this number of rows in one single INSERT statement?

If not, how should I proceed? Should I limit the number of rows fetched in the INSERT statement? How many rows can the engine handle in a single INSERT statement?

added 5 characters in body; edited title
Source Link

How does T-SQLSQL Server deal with millions of records?

To illustrate my question, the following is a query detecting order's id which have not been inserted in a data warehouse and inserts them:

With NewOrders 
As
(   
    Select OrderID From Orders
    Except
    Select OrderID From FactOrders
)
Insert Into FactOrders(OrderID, OrderDate, CustomerId)
    Select OrderID, OrderDate, CustomerId From Orders
    Where OrderID in (Select OrderID from NewOrders);

Say the query is run for the first time and Orders contains 400 million rows or more:

  1. Can T-SQLSQL Server handle this amount of rows? If not, how should I proceed? Should I limit the number of rows fetched in the insert statement?
  2. How many rows can be handled at once?

How does T-SQL deal with millions of records?

To illustrate my question, the following is a query detecting order's id which have not been inserted in a data warehouse and inserts them:

With NewOrders 
As
(   
    Select OrderID From Orders
    Except
    Select OrderID From FactOrders
)
Insert Into FactOrders(OrderID, OrderDate, CustomerId)
    Select OrderID, OrderDate, CustomerId From Orders
    Where OrderID in (Select OrderID from NewOrders);

Say the query is run for the first time and Orders contains 400 million rows or more:

  1. Can T-SQL handle this amount of rows? If not, how should I proceed? Should I limit the number of rows fetched in the insert statement?
  2. How many rows can be handled at once?

How does SQL Server deal with millions of records?

To illustrate my question, the following is a query detecting order's id which have not been inserted in a data warehouse and inserts them:

With NewOrders 
As
(   
    Select OrderID From Orders
    Except
    Select OrderID From FactOrders
)
Insert Into FactOrders(OrderID, OrderDate, CustomerId)
    Select OrderID, OrderDate, CustomerId From Orders
    Where OrderID in (Select OrderID from NewOrders);

Say the query is run for the first time and Orders contains 400 million rows or more:

  1. Can SQL Server handle this amount of rows? If not, how should I proceed? Should I limit the number of rows fetched in the insert statement?
  2. How many rows can be handled at once?
Source Link

How does T-SQL deal with millions of records?

To illustrate my question, the following is a query detecting order's id which have not been inserted in a data warehouse and inserts them:

With NewOrders 
As
(   
    Select OrderID From Orders
    Except
    Select OrderID From FactOrders
)
Insert Into FactOrders(OrderID, OrderDate, CustomerId)
    Select OrderID, OrderDate, CustomerId From Orders
    Where OrderID in (Select OrderID from NewOrders);

Say the query is run for the first time and Orders contains 400 million rows or more:

  1. Can T-SQL handle this amount of rows? If not, how should I proceed? Should I limit the number of rows fetched in the insert statement?
  2. How many rows can be handled at once?