search

Home  >  Q&A  >  body text

Index - Ask about joint query of large data volume in Mysql

Now there is table A, which stores the core and busiest data of the entire business line. The approximate amount of data online is assumed to be 1 billion. Almost all concurrency is related to this table. Recent business needs , I want to add a field, but found that the impact is too great and cannot be changed directly. The compromise solution is to add a new table B to store the ID of A and the ones that need to be added. That field

Because I don’t have access to the online database, I can’t actually test it, so I don’t know what to use

SELECT * FROM A, B ON A.id = b.aid WHERE a.xx = 'zz' AND  b.xx = 'zz'

It is better to check a large range of B first, and then use the results in the search interval of B to check A. In this case, the first method may be very accurate, but I don’t know how much the performance will be worse.

The second range is not too precise

滿天的星座滿天的星座2748 days ago673

reply all(1)I'll reply

  • PHP中文网

    PHP中文网2017-05-18 10:58:39

    You want to check the new fields in table B, why do you need to use the results in table B to check A in the second way?
    The first option is fine

    reply
    0
  • Cancelreply