<?xml version="1.0" encoding="UTF-8"?>

<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" >

  <channel>
    <title><![CDATA[Комментарии к публикации «Indexes in PostgreSQL — 1»]]></title>
    <link>https://habr.com/en/companies/postgrespro/articles/441962/</link>
    <description><![CDATA[Комментарии к публикации «Indexes in PostgreSQL — 1»]]></description>
    <language>ru</language>
    <managingEditor>editor@habr.com</managingEditor>
    <generator>habr.com</generator>
    <pubDate>Sun, 03 May 2026 17:25:05 GMT</pubDate>
    
    
      <image>
        <link>https://habr.com/ru/</link>
        <url>https://habrastorage.org/webt/ym/el/wk/ymelwk3zy1gawz4nkejl_-ammtc.png</url>
        <title>Хабр</title>
      </image>
    

    
      

      
        
  
    <item>
      <title>13.03.2019 23:32:48 erogov</title>
      <guid isPermaLink="true">https://habr.com/en/companies/postgrespro/articles/441962/#comment_19880648</guid>
      <link>https://habr.com/en/companies/postgrespro/articles/441962/#comment_19880648</link>
      <description><![CDATA[Ah, I see your point now. You're right. I should've used something like<br>
<pre><code class="pgsql">WITH t AS (SELECT ...)
SELECT * FROM t ORDER BY random();
</code></pre><br>
for that. Thanks!<br>]]></description>
      <pubDate>Wed, 13 Mar 2019 23:32:48 GMT</pubDate>
      <dc:creator><![CDATA[erogov]]></dc:creator>
    </item>
  

  
    <item>
      <title>13.03.2019 14:12:35 GreedyIvan</title>
      <guid isPermaLink="true">https://habr.com/en/companies/postgrespro/articles/441962/#comment_19878594</guid>
      <link>https://habr.com/en/companies/postgrespro/articles/441962/#comment_19878594</link>
      <description><![CDATA[No, no, no. Your way doesn't mix the rows.<br>
<br>
<pre><code class="sql">select s.id, (random()*9)::integer, (random()*9)::integer
from generate_series(1,5) as s(id)
</code></pre><br>
<pre><code class="plaintext"> a | b | c 
---+---+---
 1 | 6 | 8
 2 | 4 | 0
 3 | 2 | 5
 4 | 4 | 3
 5 | 7 | 9
(5 rows)
</code></pre><br>
<br>
And now you shuffle the rows:<br>
<pre><code class="sql">select s.id, (random()*9)::integer, (random()*9)::integer
from generate_series(1,5) as s(id)
order by random();
</code></pre><br>
<pre><code class="plaintext"> a | b | c 
---+---+---
 2 | 1 | 1
 5 | 3 | 3
 1 | 7 | 7
 4 | 7 | 7
 5 | 9 | 9
(5 rows)
</code></pre><br>
<br>
Oops.]]></description>
      <pubDate>Wed, 13 Mar 2019 14:12:35 GMT</pubDate>
      <dc:creator><![CDATA[GreedyIvan]]></dc:creator>
    </item>
  

  
    <item>
      <title>13.03.2019 09:29:21 erogov</title>
      <guid isPermaLink="true">https://habr.com/en/companies/postgrespro/articles/441962/#comment_19876422</guid>
      <link>https://habr.com/en/companies/postgrespro/articles/441962/#comment_19876422</link>
      <description><![CDATA[<p>Yeah, but my intent was to mix rows, not columns.</p>]]></description>
      <pubDate>Wed, 13 Mar 2019 09:29:21 GMT</pubDate>
      <dc:creator><![CDATA[erogov]]></dc:creator>
    </item>
  

  
    <item>
      <title>13.03.2019 05:59:37 GreedyIvan</title>
      <guid isPermaLink="true">https://habr.com/en/companies/postgrespro/articles/441962/#comment_19875172</guid>
      <link>https://habr.com/en/companies/postgrespro/articles/441962/#comment_19875172</link>
      <description><![CDATA[<p>Actually we have random order only for a column. On b and c we have a preordered values with the same random() value on each column.</p><br>
<p>That is because an expression in the order by clause is calculated one time for row.</p>]]></description>
      <pubDate>Wed, 13 Mar 2019 05:59:37 GMT</pubDate>
      <dc:creator><![CDATA[GreedyIvan]]></dc:creator>
    </item>
  

  
    <item>
      <title>12.03.2019 09:19:47 erogov</title>
      <guid isPermaLink="true">https://habr.com/en/companies/postgrespro/articles/441962/#comment_19870220</guid>
      <link>https://habr.com/en/companies/postgrespro/articles/441962/#comment_19870220</link>
      <description><![CDATA[No mistake here. You can verify the order by pageinspect extension or simply by selecting some rows from the table (in this case make sure the index is not used).<br>
<br>
For example, I get the following (<strong>before</strong> creating the index):<br>
<pre><code class="plaintext">   a   | b | c 
-------+---+---
 72673 |   | t
 70350 |   | t
 90569 |   | t
 42543 |   | t
 68301 |   | t
 67721 |   | t
 60639 |   | t
 82942 |   | t
 53841 |   | t
 97342 |   | t
(10 rows)
</code></pre><br>
<br>
Stricktly speaking, the rows are inserted sequentially; it's SELECT that returns them in random order.<br>]]></description>
      <pubDate>Tue, 12 Mar 2019 09:19:47 GMT</pubDate>
      <dc:creator><![CDATA[erogov]]></dc:creator>
    </item>
  

  
    <item>
      <title>12.03.2019 07:53:58 GreedyIvan</title>
      <guid isPermaLink="true">https://habr.com/en/companies/postgrespro/articles/441962/#comment_19869608</guid>
      <link>https://habr.com/en/companies/postgrespro/articles/441962/#comment_19869608</link>
      <description><![CDATA[<blockquote><pre><code class="sql">insert into t(a,b,c)
  select s.id, chr((32+random()*94)::integer), random() &lt; 0.01
  from generate_series(1,100000) as s(id)
  order by random();</code></pre><br>
…<br>
Rows are inserted into the table in a random order.</blockquote><br>
Here is an error. Rows won't be inserted in a random order which is expected.]]></description>
      <pubDate>Tue, 12 Mar 2019 07:53:58 GMT</pubDate>
      <dc:creator><![CDATA[GreedyIvan]]></dc:creator>
    </item>
  

  
    <item>
      <title>01.03.2019 08:53:52 erogov</title>
      <guid isPermaLink="true">https://habr.com/en/companies/postgrespro/articles/441962/#comment_19823272</guid>
      <link>https://habr.com/en/companies/postgrespro/articles/441962/#comment_19823272</link>
      <description><![CDATA[Stay tuned, more to come!]]></description>
      <pubDate>Fri, 01 Mar 2019 08:53:52 GMT</pubDate>
      <dc:creator><![CDATA[erogov]]></dc:creator>
    </item>
  

  
    <item>
      <title>28.02.2019 15:01:56 LevonTerGhazaryan</title>
      <guid isPermaLink="true">https://habr.com/en/companies/postgrespro/articles/441962/#comment_19819888</guid>
      <link>https://habr.com/en/companies/postgrespro/articles/441962/#comment_19819888</link>
      <description><![CDATA[I like your overall report]]></description>
      <pubDate>Thu, 28 Feb 2019 15:01:56 GMT</pubDate>
      <dc:creator><![CDATA[LevonTerGhazaryan]]></dc:creator>
    </item>
  

      

      

    
  </channel>
</rss>
