Insufficient memory when I perform a command
Teradata Teradata Discussion Forums Teradata.com Discussion Forum
Visit Teradata.com
Home       Guidelines    Member List
Welcome Guest ( Login | Register )
        


This online forum is for user-to-user discussions of Teradata products, and is not an official customer support channel for Teradata. If you require direct assistance, please contact Teradata support.


Insufficient memory when I perform a command Expand / Collapse
Author
Message
Posted 7/2/2009 10:57:11 AM
Forum Member

Forum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum Member

Group: Forum Members
Last Login: 8/4/2009 4:32:22 PM
Posts: 25, Visits: 131
Hi guys!

I'm facing the following problem:

I need to run at about 5000 INSERT commands at the same time.
I programmed it in C#/.Net:

command.CommandText = strInserts;
command.ExecuteNonQuery();


Into the variable string strInserts I have these values:
"INSERT INTO TABLE1(FILED1) VALUES(0);
INSERT INTO TABLE1(FILED1) VALUES(1);
.
.
.
INSERT INTO TABLE1(FILED1) VALUES(4999);"


When the command is performed, this error message appears:
"[Teradata Database] [3710] Insufficient memory to parse this request, during Resolver phase."

Please, what can I do to resolve this problem?

Thanks for help,
Anderson



Post #16005
Posted 7/2/2009 1:52:20 PM
Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: Forum Members
Last Login: 11/5/2009 4:40:02 PM
Posts: 717, Visits: 466
Hi Anderson,
you're submitting a huge multi-statement request, too huge to parse it as a single block.

- split it into several smaller batches
- Or better check if iterated request are available for .NET and use that. In JDBC it's addbatch & executebatch.

Dieter
Post #16019
Posted 7/2/2009 2:00:13 PM
Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: Forum Members
Last Login: 11/5/2009 3:36:56 PM
Posts: 151, Visits: 452
.NET Data Provider for Teradata supports batch updates.

See documentation for DbDataAdapter.UpdateBatchSize in MSDN:



http://msdn.microsoft.com/en-us/library/aadf8fk2.aspx

http://msdn.microsoft.com/en-us/library/system.data.common.dbdataadapter.updatebatchsize.aspx


--Cal
Post #16021
Posted 7/6/2009 9:20:37 AM
Forum Member

Forum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum Member

Group: Forum Members
Last Login: 8/4/2009 4:32:22 PM
Posts: 25, Visits: 131
Hi guys!

Thanks for help me!

I got the same problem (Insufficient memory) referencing my 5000 inserts to the DataAdpter's property InsertCommand.

This is sheet of the programming:

DataSet dataSet = new DataSet();
adapter.Fill(dataSet);
//_sbComandos is a StringBuilder. It contains the 5000 insert commands splitted by ';'
command.CommandText = _sbComandos.ToString();

adapter.InsertCommand = (TdCommand)comando;
adapter.InsertCommand.UpdatedRowSource = UpdateRowSource.None;

dataSet.Tables[0].Rows.Add("0");
adapter.UpdateBatchSize = 0;

adapter.Update(dataSet);


What should I do to can use the 5000 insert in Update Batch Size?
Or is there another solution?

Thanks,
Anderson
Post #16049
Posted 7/6/2009 1:38:25 PM
Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: Forum Members
Last Login: 11/5/2009 3:36:56 PM
Posts: 151, Visits: 452
The DataAdapter.InsertCommand.CommandText must be a single-row parameterized query:

Insert Into Table1(Field1) Values (?)


The DataTable, which serves as input parameter rows, must hold X rows. In your case 5000 rows.

See: http://www.teradata.com/teradataforum/Topic11803-11-2.aspx

Note I am not sure if DBS will accept 5000 rows in one query. There are other limits which govern how many rows can be send in one Query. .NET Data Provider will divide the Batch Update into one or more queries when UpdateBatchSize is set to 0. However it is very easy to experiment with different Batch Sizes.


--Cal
Post #16056
« Prev Topic | Next Topic »


Reading This Topic Expand / Collapse
Active Users: 0 ( 0 guests, 0 members, 0 anonymous members )
No members currently viewing this topic.


All times are GMT -5:00, Time now is 2:47am

Powered By InstantForum.NET v4.1.4 © 2009
Execution: 0.094. 6 queries. Compression Disabled.