Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Large Number of MySQL Insert Queries

  • This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #174757
    Rohithzr
    Participant

    previous linked post
    https://css-tricks.com/forums/topic/large-loop-of-mysql-queries/

    I want to insert a 100,000 queries into a table, statement would be complicated. I have thought of making a text file to insert data. Probably through 4 or 5 files. I have also searched the internet and found various suggestions:

    1. Try locking table before starting insertion and then unlock. [I’ll Probably block whole site for a couple of hours as i can chose the time of insert and have to it once a month.]
    2. Disable MySQL indexes. [Dont know how will it help]

    3. Use Stored Procedures. [My query will be very complicated]

    4. Batch Insert [Your Suggestion]

    5. a (single or few) [.csv] files

    6. a text file stored with queries and run it in mysql

    I need Suggestion and help in proceeding as i am no database administrator
    And I have a BigRock VPS Server. And ill probably stop the server during the transaction.

    0.88 GHz
    512 MB RAM
    20 GB HDD
    500 GB Transfer
    1 Free IP

    #174759
    __
    Participant

    Where is the data coming from?

    Is this a single, atomic transaction, or is it 100,000 individual (unrelated) records?

    Is this question directly related to our previous conversation, or is it a different issue? Regarding our last conversation, have you managed that issue? Have you decided if you’re going to hire a DBA?

    #174773
    Rohithzr
    Participant

    I think i should have written this before.

    first i will select (cId, pack_amt, opId) from customers
    then foreach cId i will check if there is a payment entry this month
    if yes the continue
    else check if there is any advance payment
    if no
    do a normal Insert Into entry
    else if yes
    treat the advance amount accordingly
    and insert the entry

    #174774
    Rohithzr
    Participant

    Where is the data coming from?

    just told in last post above

    Is this question directly related to our previous conversation, or is it a different issue?

    Yes it is the same issue

    Regarding our last conversation, have you managed that issue?

    i had postpone the issue due to other more important works so havn’t really tried but read your suggested article on procedures but as i said it will be complicated.

    Have you decided if you’re going to hire a DBA?

    I cant really hire a DBA as me and my firm is not earning that much.

Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘Back End’ is closed to new topics and replies.