upsertMemoryRecords

Upserts a batch of memory records and returns the number of changed rows.