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
  • I think we need to take a step back - what is your use case? There might be a completely different query you could run depending on what you're trying to do. How are you using this data? What is the goal?

  • Hi Peter,

    Using expression rule, We are fetching all the IDs from the database table and passing it to script task in the process model as the 'IDs to be deleted'.

    While we are executing this process model, it is failing on this script task and throwing the above error.

  • 0
    Certified Lead Developer
    in reply to ayushimittal

    Is this part of a larger DB cleanup process? Will it run periodically? Why is there so much to clean up? Could it be prevented?

    Is the query to fetch the IDs a simple one? Like "select id from table where tobedeleted=1"? If yes, did you consider to use the Query Database Node and a statement like "delete from table where tobedeleted=1". There is some drawbacks going that way, but it might be worth it.

  • Hi Stefen,

    Please find the expression rule code, we are using to fetch the data from database table:

    a!entityDataIdentifiers(
      entity: ri!Entity,
      identifiers: {
        if(
          a!queryEntity(
            entity: ri!Entity,
            query: a!query(
              selection: a!querySelection(
                columns: {
                  a!queryColumn(
                    field: "id"
                  )
                }
              ),
              pagingInfo: a!pagingInfo(
                startIndex: 1,
                batchSize: - 1
              )
            ),
            fetchTotalCount: true
          ).Totalcount = 0,
          "",
          a!queryEntity(
            entity: ri!Entity,
            query: a!query(
              selection: a!querySelection(
                columns: {
                  a!queryColumn(
                    field: "id"
                  )
                }
              ),
              pagingInfo: a!pagingInfo(
                startIndex: 1,
                batchSize: - 1
              )
            ),
            fetchTotalCount: false
          ).data.id
        )
      }
    )

    Please let me know how can I optimize it as it is fetching all the IDs need to be deleted.

  • 0
    Certified Lead Developer
    in reply to ayushimittal

    First, I strongly suggest to not do that query two times in the if() statement. Create a local variable and store the data there.

    Next. This seems like you want to delete all rows in that table. MariaDB has a special comment for this. It is called "truncate". I suggest to write a small stored procedure and use that.

Reply Children