Is cross-table indexing possible?

前端 未结 3 599
遇见更好的自我
遇见更好的自我 2020-12-14 02:10

Consider a structure where you have a many-to-one (or one-to-many) relationship with a condition (where, order by, etc.) on both tables. For example:

CREATE         


        
3条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-14 02:15

    Cross-table indexing is not possible in MySQL except via the now-defunct Akiban(?) Engine.

    I have a rule: "Do not normalize 'continuous' values such as INTs, FLOATs, DATETIMEs, etc." The cost of the JOIN when you need to sort or range-test on the continuous value will kill performance.

    DATETIME takes 5 bytes; INT takes 4. So any 'space' argument toward normalizing a datetime is rather poor. It is rare that you would need to 'normalize' a datetime in the off chance that all uses of a particular value were to change.

提交回复
热议问题