2

I use temporary tables for complex processing which is done in several "child" procedures. These procedures are working in the same session, so the temp tables are accessible for them.

Is there a similar option for memory-optimized tables?

  • 1
    Sure, you can create memory-optimized table types, and use them like table variables. There are three good articles at the top of this search. – Aaron Bertrand Feb 1 '18 at 15:08
  • @AaronBertrand Yes, I read the article, but didnt recognized the solution, which is slightly different to "normal" temp tables. Thanks a lot. You made my day – Christian Gräfe Feb 1 '18 at 15:22
2

In your case, you'd have to use a memory-optimized table variable, and assuming that the child procedures are called by the same SPID, there shouldn't be an issue with visibility. Please see this link:

https://docs.microsoft.com/en-us/sql/relational-databases/in-memory-oltp/faster-temp-table-and-table-variable-by-using-memory-optimization

I will caution you that the cardinality estimator still assumes 1 row for memory-optimized table variables, and this can be an issue for performance.

More info at this link:

https://blogs.msdn.microsoft.com/psssql/2017/05/10/memory-optimized-table-variable-and-cardinality-estimate/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.