Thanks for your reply and the research about how the temporary table is named. But I can't just move billions of records to experiment with a different backend.
I'm connecting to an MS SQL database in Azure.
Part of a convenient dplyr expression includes "copy = TRUE" to use a local tibble as a temporary table in a database join to force a set intersection to filter the data:
inner_join(targetXTypes, by = "X_TYPE_ID",
copy = TRUE) %>%
The "copy = TRUE" causes a temporary table to be created with the message shown above. But when multiple concurrent R sessions are run using the same code on different data with the same database (I believe) there's a race condition and the first session gets to create a temporary table, but the second session errors out with a duplicate temporary name.
I can do the following (which is a bit longer) to avoid the problem:
tempName <- paste0("TargetX_", format(Sys.time(), "%Y%m%d_%H%M%S"))
targetX <- copy_to(databaseConnection,
targetXTypes,
tempName)
But "copy = TRUE" should be doing something similar to avoid duplicate temporary table names.