Memory Threshold Issue

Hi,

We are facing the below error while trying to execute the expression rule to fetch data from data base table:

An error occurred while evaluating expression: listofIDtodelete:rule!abc(cons!xyz) (Expression evaluation error in rule 'abc' at function a!queryEntity [line 5]: An error occurred while retrieving the data. Details: Memory threshold reached during output conversion (rule: [queryentity expression], type: [DataReportDT7042], threshold: [1,048,576 bytes], objects successfully converted: [131,071])) (Data Outputs)

Please provide your help regarding the resolution of this issue.

  Discussion posts and replies are publicly visible

Parents Reply Children
  • 0
    Certified Lead Developer
    in reply to Mike Schmitt

    I agree with Stefan.  You're making this about two hundred thousand times harder than it needs to be.  You're gathering 100,000 ids, storing 100,000 IDs in a PV, then doing 100 subprocesses that each handle a Delete from Datastore node that is MNI 1000 times.  Or maybe trying a forEach with a delete from datastore rule that can be cloned up to a million times.  For what?  Since you're not filtering, your ultimate result will be an empty table.

    Just use the TRUNCATE command.  One step.  No Appian, no PV with mountain of data eating your RAM, no looping.  Just a few seconds and empty table.  Just get a DBA to TRUNCATE the table if you want it to have 0 rows.  Or "Execute Stored Procedure" and the stored procedure in question has only 1 line of code: TRUNCATE TABLE <name>;

    Good point Mike, but we're in the realm of optimizing code before removing it.

  • Overall I agree with you guys about how best to truncate a table (assuming they want to make their PK IDs to start back at zero, unless I'm mistaken about what TRUNCATE does).  But this inefficient querying is something I see across all sorts of use cases so I always try to point it out anyway ;-)

  • Agreed with the solutions suggested for truncating a table, but we still haven't gotten to the fundamental problem: why do you need to delete all of this data? Is this a temporary table that you're using for ETL purposes? How is the data getting populated in this table?

    I'm concerned that this is an XY problem where we're trying to solve the wrong problem.