We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 30497
    • 245 Posts
    I had a problem recently, where I was getting MySQL connection errors when working in the manager. We did some trouble shooting and along the way realized that the problem stemmed from a proxy server I was using in my browser settings. Problem solved.

    However, in investigating the issue, our server admin had this to say about how MODx updates tables:


    use update statement
    where internalKey=something
    in that way you will not need each time update all indexes for this table:

    Performance considerations:

    Please note that REPLACE INTO is a much slower performer than an UPDATE statement. Keep in mind that a REPLACE INTO requires a test on the keys, and if a matching unique key is found on any or all columns, a DELETE FROM is executed, then an INSERT is executed. There’s a lot of management of rows involved in this, and if you’re doing it frequently, you’ll hurt your performance unless you simply cannot do with any other syntax.

    The only time when I can see where you’d actually need a REPLACE INTO is when you have multiple unique constraints on a table, and need to drop any rows that would match any of the constraints. Then REPLACE INTO becomes more efficient from DELETE FROM... INSERT INTO...

    If you’re looking at a single unique column table (Primary Key), please use UPDATE, or INSERT. Also, check out INSERT ... ON DUPLIATE KEY UPDATE... as an alternative if you’re willing to stick to


    Now, because of this, my web manager, who does not know MODx, wants to hack the core and make such a change huh . I see no need for this, but I wanted to get some feedback, preferably from the MODx development team, about the quote I have included above, and whether the assessment the server admin guy makes here is correct or incorrect.

    Thanks.
      • 25663 MODX Staff
      • 12,272 Posts
      Very interesting. You might want to create a bug tracker report for this in JIRA.
        Ryan Thrash, MODX Co-Founder
        Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me