TransWikia.com

should I select columns before or after join?

Database Administrators Asked on October 28, 2021

I have a join that takes a lot of time:

select t1.*, t.b from t1 join (select id, b from t2) t on t1.id = t.id

I have an index on id in t2.

  1. Is index on id preserved when I create a derived table t?
  2. In terms of performance, do I need to select from t2, or would this be always as fast:

select t1.*, t.b from t1 join t2 t on t1.id = t.id ?

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP