mercurylanded
V2EX  ›  问与答

懒人使用 orm 的时候是使用 in 查询还是 for 循环之后一个个查

  •  1
     
  •   mercurylanded · Dec 21, 2020 · 1456 views
    This topic created in 1974 days ago, the information mentioned may be changed or developed.

    A,B 两个表之间有一个共同的 processId 字段,这个字段上面有索引 你们查询的时候是 B.processId in [A.processId] 还是 for processId in [A.processId] B.processId = processId

    5 replies    2020-12-21 13:33:46 +08:00
    badbye
        1
    badbye  
       Dec 21, 2020
    这和懒不懒没关系吧...关乎到性能问题
    waising
        2
    waising  
       Dec 21, 2020
    我会用 in 不知道为什么我感觉 for 更科学
    ymz
        3
    ymz  
       Dec 21, 2020
    in
    wdxm2008
        4
    wdxm2008  
       Dec 21, 2020
    in
    mercurylanded
        5
    mercurylanded  
    OP
       Dec 21, 2020
    @assiadamo 真的会有性能问题的话还是单独弄个联表查询会更好。但是大部分那时候使用 orm 都直接写了
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1644 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 32ms · UTC 16:44 · PVG 00:44 · LAX 09:44 · JFK 12:44
    ♥ Do have faith in what you're doing.