I am creating a mysql temp table in my rails application (3.2). I attempt to manually drop the table by running the following:
ActiveRecord::Base.connection.execute("DROP TEMPORARY TABLE `Example`")
For some reason the table is not being dropped and continues to exist even when I make a new request to the server. Any ideas on what could be going on?
Related
I'm trying to run a query into a table in our MySQL database, table is called 'ac_userdata'. Whenever i run a query or update or anything, it just constantly loads and eventually (after ~5 minutes) it times out. I tried dropping the table and making a new one, but i can't even drop it. I checked to see if the table was locked, and even unlocked all tables in the database, no luck. No other table in the database and on the server has this problem, and this is one of the smallest tables in the database...
Any ideas?
Thanks!
Erouax
If there is only one table in database or you have tried to drop the table then why you don't drop the database delete database and create a new one if your current database have no data.
I'm trying to drop a table containing several hundred thousand column-based records. Normally when creating the database I use a column-based engine (infinidb) but in this case I forgot to include the ENGINE statement. So the database is pretty much unusable for my needs. Now I have a database full of tables that are taking forever to drop (it's been two hours and nothing has happened). I tried the ALTER TABLE table ENGINE=INFINIDB command but again, it's taking forever (see above re: two hours). EDIT: The first command I tried was DROP TABLE. It hung with every single table. Then I tried the ALTER command in case that was faster for some reason, but it wasn't.
Is there another way to get rid of this database? E.g. manually going into the /mysql/ directory and deleting the database? I guess I could just rename it and leave it, but I'd rather get rid of it entirely so it's not taking up space.
First of all you said Can't drop table. But in post you mentioned ALTER TABLE table ENGINE=INFINIDB.
But DROP != ALTER it is two different things.
So you can do following:
CREATE new table with same structure but engine you need.
copy(UPDATE) data from old table to the one you just created.
DROP old table.
RENAMErename new one to old name
It turned out that another process (a website) was using this database and had a couple of queries that got 'stuck' in the SQL server and caused the table to hang due to the database using the wrong engine, which I'm assuming was InnoDB since I didn't specify an engine when I initially used the "CREATE TABLE table1 AS SELECT * FROM table2" command. We finally managed to wipe the database and start over. Thanks for your help.
I am trying to use MySql temporary tables with my joomla site.
the problem is that whenever I query about the content of the table I get an empty result (except when using select statement in the same function where I create the table).
My questions are:
everytime I use $db = JFactory::getDBO() - do I create a new DB connection?
if so - how can I use temporary files?
if not - why don't I get the data of the temp table?
How can I create a temporary table that will remain until the user logs out?
You cannot use temporary tables like this, read the docs on temporary tables in MySQL here. The table will be deleted on each session, which will probably be each page load, possibly sooner, depending on how this is handled throughout Joomla.
If you want your temporary table to persist, you need to create normal table, not a temporary table...
I am using mysql table on my website where I update table frequently. Instead of altering table on remote server I do it on localhost and then upload it. While uploading I drop table first which causes problem for website user for a moment.
Is there anyway to replace table without dropping.
You can upload the table with a temporary name. After the upload completes you can drop the original and rename the temporary.
In this way the downtime would be very limited.
I have encountered a problem after i changed my DSN from POC server to point to my new Testing server without realizing that both environment tables columns are not in sync. There are 2 columns missing in my POC server which exist in both Test and Production server.
After i re-pointed the Universe's DSN to the test server, how do i refresh the existing table in my universe to auto refresh the 2 missing columns? Below is what i have tried:
I tried to drag the missing columns into the existing table but it was not allowed.
I tried to delete the existing table and drag out the entire table with same name, the 2 missing columns finally appears, but it create more issues as all my existing dimensions created were screwed up due to an "Unresolved table". It seems that it found that the original table was deleted and the new one is not matched.
There is no refresh table function available.
Please advise. Thanks.
Select the table, then hit View->Refresh Structure.