<divclass="highlight highlight-text-adblock"><pre>[Business] time, data -> convert to unix timestamp milliseconds -> [Database] int64</pre></div>
<h2><aid="user-content-be-careful-with-null"class="anchor"aria-hidden="true"href="#be-careful-with-null"><spanaria-hidden="true"class="octicon octicon-link"></span></a>Be careful with NULL</h2>
<p>If compare with field which can be NULL, remember to check NULL for safety.</p>
<divclass="highlight highlight-source-sql"><pre><spanclass="pl-c"><spanclass="pl-c">--</span> field_something can be NULL</span>
<p>Prefer <code>VARCHAR</code> if you need to query and of course use index, and make sure size of value will never hit the limit.
Prefer <code>TEXT</code> if you don't care, just want to store something.</p>
<h2><aid="user-content-be-super-careful-when-migrate-update-database-on-production-and-online"class="anchor"aria-hidden="true"href="#be-super-careful-when-migrate-update-database-on-production-and-online"><spanaria-hidden="true"class="octicon octicon-link"></span></a>Be super careful when migrate, update database on production and online!!!</h2>
<p>Plase read docs about online ddl operations before do anything online (keep database running the same time update it, for example create index, ...)</p>
<ul>
<li>
<ahref="https://dev.mysql.com/doc/refman/5.7/en/innodb-online-ddl-operations.html"rel="nofollow">For MySQL 5.7</a>, <ahref="https://dev.mysql.com/doc/refman/5.7/en/innodb-online-ddl-limitations.html"rel="nofollow">Limitations</a>
</li>
<li>
<ahref="https://dev.mysql.com/doc/refman/8.0/en/innodb-online-ddl-operations.html"rel="nofollow">For MySQL 8.0</a>, <ahref="https://dev.mysql.com/doc/refman/8.0/en/innodb-online-ddl-limitations.html"rel="nofollow">Limitations</a>
<li><ahref="https://use-the-index-luke.com/"rel="nofollow">Use The Index, Luke</a></li>
<li><ahref="https://www.foxhound.systems/blog/essential-elements-of-high-performance-sql-indexes/"rel="nofollow">Essential elements of high performance applications: SQL indexes</a></li>
<li><ahref="https://architecturenotes.co/things-you-should-know-about-databases/"rel="nofollow">Things You Should Know About Databases</a></li>