MySQL insert into different databases tables based on PK value3 Databases, Best Replication...

Taking an academic pseudonym?

The totem pole can be grouped into

Should you blow through the final approach course if the ATC forgot about you?

What are the drawbacks of putting my staging and production dbs into one Azure Elastic Pool?

Does the phrase がんばする makes sense?

Badly designed reimbursement form. What does that say about the company?

Simple Question About Conservation of Angular Momentum

Is candidate anonymity at all practical?

How to make clear what a part-humanoid character looks like when they're quite common in their world?

Can a rabbi conduct a marriage if the bride is already pregnant from the groom?

Have any astronauts or cosmonauts died in space?

Finding a basis of an infinite dimensional vector space with a given vector

Was Opportunity's last message to Earth "My battery is low and it's getting dark"?

Why did Tywin never remarry?

How can I get results over the whole domain of my non-linear differential equations?

Coworker is trying to get me to sign his petition to run for office. How to decline politely?

Does limiting the number of sources help simplify the game for a new DM with new and experienced players?

Run a command that requires sudo after a time has passed

"Cheaper by the dozen" phrase origin?

Suggestions on how to improve logo

Ethernet cable only works in certain positions

Why is it a problem for Freddie if the guys from Munich did what he wanted?

How can I portray body horror and still be sensitive to people with disabilities?

Does a code with length 6, size 32 and distance 2 exist?



MySQL insert into different databases tables based on PK value


3 Databases, Best Replication Setup?Master-Master Replication in MySQLMySQL Triggers Different Database Different ServerOnce in a while synchronization of the independently updated mysql databases problemmysql statement based replication - unsafe statementsDatabase migration, how toMySQL table replication on the same serverIs there a performance hit for querying two different databases?Import/Exporting certain columns of a table across two databases and excluding duplicate emails in mysqlMerge 2 pairs of tables from 2 databases. Beginner













0















Lets assume i have two databases, both having a table 'user_feedback', working as a shard. My goal is to insert all records where Primary key Id%2=0 goes to db1.user_feedback, and Id%2=1 goes to db2.user_feedback.



Is there a condition in the INSERT statement that can allow me to do this? How can i achieve simply achieve this, both if the two databases are located on the same MySQL server, and when they both reside on a different MySQL server?









share







New contributor




user172927 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

























    0















    Lets assume i have two databases, both having a table 'user_feedback', working as a shard. My goal is to insert all records where Primary key Id%2=0 goes to db1.user_feedback, and Id%2=1 goes to db2.user_feedback.



    Is there a condition in the INSERT statement that can allow me to do this? How can i achieve simply achieve this, both if the two databases are located on the same MySQL server, and when they both reside on a different MySQL server?









    share







    New contributor




    user172927 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.























      0












      0








      0








      Lets assume i have two databases, both having a table 'user_feedback', working as a shard. My goal is to insert all records where Primary key Id%2=0 goes to db1.user_feedback, and Id%2=1 goes to db2.user_feedback.



      Is there a condition in the INSERT statement that can allow me to do this? How can i achieve simply achieve this, both if the two databases are located on the same MySQL server, and when they both reside on a different MySQL server?









      share







      New contributor




      user172927 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.












      Lets assume i have two databases, both having a table 'user_feedback', working as a shard. My goal is to insert all records where Primary key Id%2=0 goes to db1.user_feedback, and Id%2=1 goes to db2.user_feedback.



      Is there a condition in the INSERT statement that can allow me to do this? How can i achieve simply achieve this, both if the two databases are located on the same MySQL server, and when they both reside on a different MySQL server?







      mysql insert sharding





      share







      New contributor




      user172927 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.










      share







      New contributor




      user172927 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.








      share



      share






      New contributor




      user172927 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked 1 min ago









      user172927user172927

      1




      1




      New contributor




      user172927 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      user172927 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      user172927 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






















          0






          active

          oldest

          votes











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "182"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });






          user172927 is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f230226%2fmysql-insert-into-different-databases-tables-based-on-pk-value%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          user172927 is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          user172927 is a new contributor. Be nice, and check out our Code of Conduct.













          user172927 is a new contributor. Be nice, and check out our Code of Conduct.












          user172927 is a new contributor. Be nice, and check out our Code of Conduct.
















          Thanks for contributing an answer to Database Administrators Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f230226%2fmysql-insert-into-different-databases-tables-based-on-pk-value%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          ORA-01691 (unable to extend lob segment) even though my tablespace has AUTOEXTEND onORA-01692: unable to...

          Always On Availability groups resolving state after failover - Remote harden of transaction...

          Circunscripción electoral de Guipúzcoa Referencias Menú de navegaciónLas claves del sistema electoral en...