Server or code?

Status
Not open for further replies.

liguehs

New Member
Messages
62
Reaction score
0
Points
0
Hi guys,
I have a question...

I have a code that reads a text file and inserts it into a DB... I used it before and it works well... but now it goes till 1859 and stops inserting...why?

Furthermore, I have a code that is almost the same and that one works and inserts/updates succesfully the 3500 datas...

Where could be the problem?

Thanks for your help,
 

descalzo

Grim Squeaker
Community Support
Messages
9,372
Reaction score
326
Points
83
Insertions take more time for:

size of row
number of indexes on table
size of table

also, if the query inserts 100 rows at a time, it is more efficient than looping over 100 queries each inserting one row.

If you have more than just the primary key on the table ( MyISAM ), you can try using DISABLE KEYS before the insert and ENABLE KEYS afterward.

You can also try locking/unlocking the table.

Lastly, look into LOAD DATA INFILE.

MySQL documentation on speed of INSERT
 
Last edited:

descalzo

Grim Squeaker
Community Support
Messages
9,372
Reaction score
326
Points
83
Are you inserting into an existing table? How many indexes do you have?

Bulk inserting into a new table is much faster than inserting into a large established table.
 

liguehs

New Member
Messages
62
Reaction score
0
Points
0
The code checks if there if there is already a user and if there it updates, if not it inserts...

I tried dropping the table, creating a new one, without succes...
Edit:
And what I dont get is, it inserts well the 1858 first entries.

The 1 859, it inserts until line 7 well and it stoppes at line8 after inserting some of the value...
 
Last edited:

descalzo

Grim Squeaker
Community Support
Messages
9,372
Reaction score
326
Points
83
The code checks if there if there is already a user and if there it updates, if not it inserts...

I tried dropping the table, creating a new one, without succes...
Edit:
And what I dont get is, it inserts well the 1858 first entries.

The 1 859, it inserts until line 7 well and it stoppes at line8 after inserting some of the value...

If it halts at the same place each time, have you looked at the data that is causing it to halt?

You might have a unique key on a field that is being repeated, or some other problem.
 

jamessmith

New Member
Messages
59
Reaction score
0
Points
0
I had this error once.

Turns out Firefox doesn't like sending too much data over the web with Windows 7 x64.
 

leafypiggy

Manager of Pens and Office Supplies
Staff member
Messages
3,818
Reaction score
163
Points
63
Or, the server is doing it's job, and not allowing script execution to go over (I think) 30 seconds.

Problem solved?
 
Status
Not open for further replies.
Top