1

I loaded ~100M rows into my sql using the 'load data' command. After loading the data, I checked the information schema and saw that the table was populated:

SELECT table_name "Table Name", table_rows "Rows Count", round(((data_length +
index_length)/1024/1024),2)  "Table Size (MB)" FROM information_schema.TABLES
WHERE table_schema = "testDB" AND table_name ="TweetPerson";

+-------------+------------+-----------------+
| Table Name  | Rows Count | Table Size (MB) |
+-------------+------------+-----------------+
| TweetPerson |   88355921 |        19517.00 |
+-------------+------------+-----------------+

But when I try to count the rows of the table or use any select statements on it I get row count of 0 or the empty set:

select count(*) from TweetPerson; 

+----------+
| count(*) |
+----------+
|        0 |
+----------+

I am using MySQL 5.6. When I loaded the data I used the following commands to speed up the process:

SET FOREIGN_KEY_CHECKS = 0;
SET UNIQUE_CHECKS = 0;
SET SESSION tx_isolation='READ-UNCOMMITTED';
SET sql_log_bin = 0;
SET autocommit = 0;

What could be the issue here?

Thanks

UPDATE After the load data I tried to set autocommit back to 1 but it did not change anything. I restarted the load from the beginning with autocommit set to 1 and the data loaded correctly.

I can't tell what was the problem with the first data loading but I highly suspect that it had something to do with the autocommit.

13
  • try to execute query using database name in it. select count(*) from databasename.TweetPerson; Commented Mar 14, 2016 at 13:44
  • @VickyThakor tried. Same results. Commented Mar 14, 2016 at 13:45
  • Does select * from TweetPerson works? Commented Mar 14, 2016 at 13:47
  • No. It returns the empty set Commented Mar 14, 2016 at 13:49
  • 3
    Have you tried committing the inserts - or turning autocommit back on, which should do the same. The autocommit mode. If set to 1, all changes to a table take effect immediately. If set to 0, you must use COMMIT to accept a transaction or ROLLBACK to cancel it. If autocommit is 0 and you change it to 1, MySQL performs an automatic COMMIT of any open transaction. Another way to begin a transaction is to use a START TRANSACTION or BEGIN statement. See Section 12.3.1, “START TRANSACTION, COMMIT, and ROLLBACK Syntax”. Commented Mar 14, 2016 at 13:50

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.