created in-memory table sorting procedure