Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Temporal Data Models

Kurochan
September 27, 2017
200

Temporal Data Models

Kurochan

September 27, 2017
Tweet

More Decks by Kurochan

Transcript

  1. SnapShot Model • ࡞੒ DBNQBJHO DBNQBJHO@JE JT@BDUJWF DSFBUF VQEBUF EFMFUF

        SELECT is_active FROM campaign WHERE campaign_id = 1000 AND deleted_at IS NULL ; +-----------+ | is_active | +-----------+ | 0 | +-----------+
  2. SnapShot Model • ߋ৽ DBNQBJHO DBNQBJHO@JE JT@BDUJWF DSFBUF VQEBUF EFMFUF

        SELECT is_active FROM campaign WHERE campaign_id = 1000 AND deleted_at IS NULL ; +-----------+ | is_active | +-----------+ | 1 | +-----------+
  3. SnapShot Model • ࡟আ DBNQBJHO DBNQBJHO@JE JT@BDUJWF DSFBUF VQEBUF EFMFUF

         SELECT is_active FROM campaign WHERE campaign_id = 1000 AND deleted_at IS NULL ; +-----------+ | is_active | +-----------+ | null | +-----------+
  4. SnapShot Model • ݱࡏͷঢ়ଶ͔͠Θ͔Βͳ͍(Ұ࣌఺ͰͷSnapShot) • ઃఆཤྺ͕Θ͔Βͳ͍ • ࠷ޙʹߋ৽͞Εͨ࣌ࠁ͔͠Θ͔Βͳ͍ • ઃఆ͕มΘΔ͝ͱʹϩάϑΝΠϧΛు͘ʁ

    • ઃఆͷ༧໿͕Ͱ͖ͳ͍ • ઃఆΛม͍͑ͨ࣌ࠁ·Ͱ଴͔ͭ͠ͳ͍ • ༧ఆ࣌ࠁʹઃఆΛߋ৽͢ΔόονΛͭ͘Δʁ
  5. Transaction • 9/1ʹΩϟϯϖʔϯΛONʹ͢ΔઃఆΛೖΕͨ
 9/14ʹΩϟϯϖʔϯΛOFFʹ͢ΔઃఆΛೖΕͨ • ΩϟϯϖʔϯONͷTransaction Time: 9/1ʙ 9/14 •

    9/1ʹCPCΛ100ԁʹ͢ΔઃఆΛೖΕͨ • CPC100ԁͷTransaction Time: 9/1ʙ • ※ͦͷϨίʔυ͕DB্Ͱ༗ޮͰ͋ͬͨظؒʹ஫໨
  6. Transactional Data Model • ࡞੒ (now() = 2017/09/01) DBNQBJHO DBNQBJHO@JE

    JT@BDUJWF JO PVU     SELECT is_active FROM campaign WHERE campaign_id = 1000 AND in <= NOW() AND out > NOW() ; +-----------+ | is_active | +-----------+ | 0 | +-----------+
  7. Transactional Data Model • ߋ৽ (now() = 2017/09/02) DBNQBJHO DBNQBJHO@JE

    JT@BDUJWF JO PVU         SELECT is_active FROM campaign WHERE campaign_id = 1000 AND in <= NOW() AND out > NOW() ; +-----------+ | is_active | +-----------+ | 1 | +-----------+
  8. Transactional Data Model • ߋ৽ (now() = 2017/09/10) DBNQBJHO DBNQBJHO@JE

    JT@BDUJWF JO PVU             SELECT is_active FROM campaign WHERE campaign_id = 1000 AND in <= NOW() AND out > NOW() ; +-----------+ | is_active | +-----------+ | 0 | +-----------+
  9. Transactional Data Model • ࡟আ (now() = 2017/09/20) DBNQBJHO DBNQBJHO@JE

    JT@BDUJWF JO PVU             SELECT is_active FROM campaign WHERE campaign_id = 1000 AND in <= NOW() AND out > NOW() ; +-----------+ | is_active | +-----------+ | null | +-----------+
  10. Fact • 9/2͔ΒΩϟϯϖʔϯ͕ONʹͳΔ
 9/16͔ΒΩϟϯϖʔϯ͕OFFʹͳΔ • ΩϟϯϖʔϯONͷValid Time: 9/2 ʙ 9/16

    • 9/1ʹCPCΛ100ԁʹ͢Δ • CPC100ԁͷValid Time: 9/1ʙ • ※ࣄ࣮ʹ஫໨͢Δ(࣮ࡍʹDBʹઃఆͨ࣌͠ࠁ͸ؔ܎ͳ͍)
  11. Valid Time Data Model • now() = 8/31 SELECT is_active

    FROM campaign WHERE campaign_id = 1000 AND from <= NOW() AND thru > NOW() ; +-----------+ | is_active | +-----------+ | null | +-----------+ DBNQBJHO DBNQBJHO@JE JT@BDUJWF GSPN UISV            
  12. Valid Time Data Model • now() = 9/1 SELECT is_active

    FROM campaign WHERE campaign_id = 1000 AND from <= NOW() AND thru > NOW() ; +-----------+ | is_active | +-----------+ | 0 | +-----------+ DBNQBJHO DBNQBJHO@JE JT@BDUJWF GSPN UISV            
  13. Valid Time Data Model • now() = 9/2 SELECT is_active

    FROM campaign WHERE campaign_id = 1000 AND from <= NOW() AND thru > NOW() ; +-----------+ | is_active | +-----------+ | 0 | +-----------+ DBNQBJHO DBNQBJHO@JE JT@BDUJWF GSPN UISV            
  14. Valid Time Data Model • now() = 9/10 SELECT is_active

    FROM campaign WHERE campaign_id = 1000 AND from <= NOW() AND thru > NOW() ; +-----------+ | is_active | +-----------+ | 0 | +-----------+ DBNQBJHO DBNQBJHO@JE JT@BDUJWF GSPN UISV            
  15. Valid Time Data Model • now() = 9/20 SELECT is_active

    FROM campaign WHERE campaign_id = 1000 AND from <= NOW() AND thru > NOW() ; +-----------+ | is_active | +-----------+ | null | +-----------+ DBNQBJHO DBNQBJHO@JE JT@BDUJWF GSPN UISV            
  16. BiTemporal Data Model • ࡞੒ (now() = 2017/09/01) SELECT is_active

    FROM campaign WHERE campaign_id = 1000 AND in <= NOW() AND out > NOW() AND from <= NOW() AND thru > NOW() ; +-----------+ | is_active | +-----------+ | null | +-----------+ DBNQBJHO DBNQBJHO@JE JT@BDUJWF JO PVU GSPN UISV      
  17. BiTemporal Data Model • now() = 2017/09/02 SELECT is_active FROM

    campaign WHERE campaign_id = 1000 AND in <= NOW() AND out > NOW() AND from <= NOW() AND thru > NOW() ; +-----------+ | is_active | +-----------+ | 1 | +-----------+ DBNQBJHO DBNQBJHO@JE JT@BDUJWF JO PVU GSPN UISV      
  18. BiTemporal Data Model • ߋ৽ (now() = 2017/09/14) SELECT is_active

    FROM campaign WHERE campaign_id = 1000 AND in <= NOW() AND out > NOW() AND from <= NOW() AND thru > NOW() ; +-----------+ | is_active | +-----------+ | 1 | +-----------+ DBNQBJHO DBNQBJHO@JE JT@BDUJWF JO PVU GSPN UISV                  
  19. BiTemporal Data Model • now() = 2017/09/16 SELECT is_active FROM

    campaign WHERE campaign_id = 1000 AND in <= NOW() AND out > NOW() AND from <= NOW() AND thru > NOW() ; +-----------+ | is_active | +-----------+ | 0 | +-----------+ DBNQBJHO DBNQBJHO@JE JT@BDUJWF JO PVU GSPN UISV                  
  20. BiTemporal Data Model • ࡟আ (now() = 2017/10/01) DBNQBJHO DBNQBJHO@JE

    JT@BDUJWF JO PVU GSPN UISV                   SELECT is_active FROM campaign WHERE campaign_id = 1000 AND in <= NOW() AND out > NOW() AND from <= NOW() AND thru > NOW() ; +-----------+ | is_active | +-----------+ | null | +-----------+