2

I got two tables (one with 33k rows and another with 7k rows). I want to compare the two tables and delete the rows in which the two id's dont match. But when i send off the query, it freezes phpmyadmin. Could the tables be too big?

SELECT * FROM likes LEFT OUTER JOIN uploads on likes.upload_id = uploads.upload_id WHERE uploads.upload_id IS NULL 

I know databases are meant to handle millions of data, so i'm not sure where the error lies.

Best regards, Mathias

5 Answers5

3

I would do an explain so you can see what mysql does. This would give a good indication on what how many rows are used.

EXPLAIN SELECT * FROM likes LEFT OUTER JOIN uploads on likes.upload_id = uploads.upload_id WHERE uploads.upload_id IS NULL

you could also use another browser or another session to use show processlist to see how the query is executed.

Rene Pot
  • 24,681
  • 7
  • 68
  • 92
2

Tables probably aren't too big but PhpMyAdmin's query timeout might be an issue if the script takes a long time to finish. Try and change the timeout or don't use PhpMyAdmin at all. See if you are able to so the query using command line on the server (or some other tool).

See also:

Community
  • 1
  • 1
ZZ-bb
  • 2,157
  • 1
  • 24
  • 33
0

Does Freeze imply it's working but never updates/ never "finishes" the task?

If so,
I have had a similar thing and found they've been due to having more than one index on a column, for example a column has a PRIMARY index and an index named after the column, so check your indexes

Martin
  • 22,212
  • 11
  • 70
  • 132
0

I sometimes run large import "queries" that can take a few hours to process. (I untick "Partial import -> Allow the interruption of an import...".)

phpMyAdmin will not respond in the browser I started the queries in, even if I try to reload the page, but if I go to a browser on another machine with (I assume) a different IP address phpMyAdmin responds fine.

On the other browser I then issue the SQL command SHOW FULL PROCESSLIST to monitor and kill that long running query if need be.

Community
  • 1
  • 1
Matthew Lock
  • 13,144
  • 12
  • 92
  • 130
0

you can just uncheck to two option in import

1 - Allow the interruption of an import in case the script detects it is close to the PHP timeout limit. (This might be a good way to import large files, however it can break transactions.)

2- Enable foreign key checks

Vahid Alvandi
  • 588
  • 9
  • 17