If there is a table called

, there will be a column called user_no.

Connect with LEFT JOIN to retrieve all information at once
Extract information for each table

Which is faster?

I ’m sorry for the poor explanation.

  • Answer # 1

    Create a CREATE TABLE statement, a CREATE INDEX statement, and a SELECT statement that can execute it in a question. By checking the execution plan, you can determine whether it is roughly efficient SQL.

    Don't forget to measure the processing time.

  • Answer # 2

    When the same value for user_no exists in all tables
    It may not make sense to normalize.

    On the other hand, when it is in a state where it is impossible to predict which table has what

    select user_no from user_data1
    union select user_no from user_data2
    union select user_no from user_data3
    union select user_no from user_data4

    It is reasonable to create a list of user_no in

    and then left join sequentially

    If user_no is not unique, data is obtained by join
    Please carefully scrutinize the operation method as it is likely to become enlarged