Replica read server temporary table alternative

Hi Team,

we are using temp table in procedure and we have to run that get data procedure which has temp table and have to run and read data directly from replica read server but its failing with error like ‘Creating temporary tables in disaster recovery databases’ is not supported by MemSQL.

please share some alternative?

It sounds like you are running REPLICATE DATABASE to replicate a DB to another cluster, and you want to run code on that other cluster that creates a temp table.

The error says that you cannot create temp tables in a replica DB, which makes sense, because you cannot update a replica DB directly. It can only be updated from the replication log stream.

A possible workaround is to create a different database on the replica cluster, that is a regular, writeable database. Then put the temp table in there. You can reference the tables in your code using a two-part name like dbname.tblname

Your code can reference both the replica tables and the temp tables that way, as needed.

1 Like