<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>mask0702</author_name>
  <author_url>https://blog.hatena.ne.jp/mask0702/</author_url>
  <blog_title>くわこのpermission denied.</blog_title>
  <blog_url>https://mask.hatenadiary.com/</blog_url>
  <categories>
    <anon>PostgreSQL</anon>
    <anon>MySQL</anon>
  </categories>
  <description>ランダムに２０件のデータを抽出するには SELECT * FROM {table名} ORDER BY RAND() LIMIT 20; で書ける。 ランダム関数はMySQLではRAND()でPostgresではRANDOM()で書ける。けど先輩に聞いた話だと、SQLのランダムは遅いらしいので、普通にPHPなどにランダムを書いてそれを実行した方がいいらしいです。追記 調べたら * を使っているのがRAND()の遅い原因らしい。 MySQLでSQLのみを使用してランダム取得を劇的に早くする方法 - 僕のススメ。</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fmask.hatenadiary.com%2Fentry%2F2014%2F07%2F01%2F095748&quot; title=&quot;SQLでランダムに抽出 - くわこのpermission denied.&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2014-07-01 09:57:48</published>
  <title>SQLでランダムに抽出</title>
  <type>rich</type>
  <url>https://mask.hatenadiary.com/entry/2014/07/01/095748</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
