<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>さくらたんどっとびーず &#187; API</title>
	<atom:link href="http://sakuratan.biz/archives/tag/API/feed" rel="self" type="application/rss+xml" />
	<link>http://sakuratan.biz</link>
	<description>モロモロ工事中です</description>
	<lastBuildDate>Sun, 25 Jun 2023 12:51:51 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>TwitterのIDが64bitになったのは知ってるけどぶっちゃけどう対応すりゃえーのん？</title>
		<link>http://sakuratan.biz/archives/2855</link>
		<comments>http://sakuratan.biz/archives/2855#comments</comments>
		<pubDate>Fri, 17 Dec 2010 15:14:17 +0000</pubDate>
		<dc:creator>さくら</dc:creator>
				<category><![CDATA[Twitter]]></category>
		<category><![CDATA[API]]></category>

		<guid isPermaLink="false">http://sakuratan.biz/?p=2855</guid>
		<description><![CDATA[てことで必要にせまられて調べてみますた。 まず知っとかないといけないことは The Twitter Engineering Blog: Announcing Snowflake と README.mkd at master from twitter&#8217;s snowflake &#8211; GitHub にほとんど書かれています。英語読むの面倒な人のために重要なところだけ超訳します。 T... <div style="margin-top:1ex"><a href="http://sakuratan.biz/archives/2855">(続きを読む)</a></div>]]></description>
			<content:encoded><![CDATA[<p>てことで必要にせまられて調べてみますた。</p>
<p>まず知っとかないといけないことは <a href="http://engineering.twitter.com/2010/06/announcing-snowflake.html">The Twitter Engineering Blog: Announcing Snowflake</a> と <a href="https://github.com/twitter/snowflake/blob/master/README.mkd">README.mkd at master from twitter&#8217;s snowflake &#8211; GitHub</a> にほとんど書かれています。英語読むの面倒な人のために重要なところだけ超訳します。</p>
<ol>
<li>Twitter の ID は 64bit です。64bit の内訳は、41bit のミリ秒／10bit のマシンID／12bitのマシン毎の連番（と明示されてないけど符号に1bit）です。</li>
<li>ID は大雑把（ミリ秒単位で同一時刻に投稿されたツイートの順序は不定）にソートされています。ソート順序は不変です。</li>
</ol>
<p>プログラミング視点ですと、64bit 整数（一応符号付きで良いっぽい、詳しくは<a href="http://groups.google.com/group/twitter-development-talk/browse_thread/thread/5152a34a8ae6ccb6/1edb5cd6002f6499">ここ</a>参照）で、ソートキーとして使えるってあたりが必要な情報ですた。</p>
<p>ということなんで MySQL なら BIGINT UNSIGNED にしときゃいいっぽいです。（MySQL は MySQL で <a href="http://dev.mysql.com/doc/refman/5.1/ja/numeric-type-overview.html">BIGINT の扱いに微妙な点がある</a>ので UNSIGNED にする意味はあんま無いっぽいですが一応付けといた方が無難かと。）</p>
<p>一応整数値らしいので、文字列で保持するとかは止めといた方が良いと思いまつ。<a href="http://ja.wikipedia.org/wiki/2001%E5%B9%B49%E6%9C%889%E6%97%A5%E5%95%8F%E9%A1%8C">2001年9月9日問題</a>みたいな感じになるかもしれません。</p>
]]></content:encoded>
			<wfw:commentRss>http://sakuratan.biz/archives/2855/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
