Reputation: 2735
I have written a code to create temporary table on every http request. For the very first request table is created successfully however on the second request it gives me error as Table 'xxx' already exists
. when i restarted my local machine server(thin web server) and hit the http request then again temporary table is created without error.
Does this mean that temporary tables are shared between different http request and are destroyed automatically when machine or server is restarted??
Thanks,
Upvotes: 1
Views: 426
Reputation: 2582
As far as I know temporary table exists until connection to the database is closed. In Rais you have a pool of connections to the database and different requests can use different connections.
So if you create temporary table in the first http request, second request can use the same connection and you can receive a SQL error when is trying to create it again, but in second request use another connection temporary table will not exist yet.
Upvotes: 1