"Access denied" when creating temporary tables


#1

Is it possible to create temporary tables?


#2

Can I tell you already know the answer?: https://forum.infinityfree.net/discussion/1567/views-cannot-be-created


#3
I'd say the "access denied" error you get already tells you whether you can create such tables.

I don't know exactly why it was disabled, but, judging by the documentation, I can imagine why. I see various sandboxing problems with temporary tables which could cause security and performance issues.

#4

Any suggestion for an alternative approach?


#5
panchitio said:
Any suggestion for an alternative approach?
I can help you come up with an alternative way to do what you need to do. Can you please elaborate a bit on what you intended to use the temporary tables for in the first place?

#6

I need to hold kart’s data for invoicing later, without taxing the online database. Your help is greatly appreciated.


#7
If your goal is to not tax the database, then you should not interact with the database to begin with. The main difference between a temporary table and a regular table is that the temporary table is automatically deleted when the database connection is closed. The SELECT, INSERT, UPDATE and DELETE queries on a temporary table create just as much server load as on a regular table. Come to think of it, the temporary tables would create even more server load because new tables would have to be created and deleted every time.

So why not keep it out of the database altogether? Why not just keep the data in the PHP code? And if you need the data to persist in multiple requests (which temporary tables don't, by the way), you could use PHP Sessions for that.