gin index doesn't work

it seems that my server won't use gin index.

  • I've created a new database with one table.
  • I've inserted one row as example.
  • I've loaded trigram extension and created gin index using trigrams
  • But when I check if the index works right I can see it doesn't
  • Any ideas?
  • SQL: http://pastebin.com/1yDQQA1Z

    PS A day ago I've followed a tutorial about trigrams. Basically it was the same like my example above. The table had 2 columns, numeric(5, 0) and character varying (the one with gin trgm index). Query was with like operator using "%" and index was working (I could see Bitmap using in query explain), so I know, my server can use index (and its properly installed).

    Thanks in advance.


    Don't test on one row, it is meaningless.

    Here's an excerpt of the documentation explaining why, in Examining Index Usage:

    Use real data for experimentation. Using test data for setting up indexes will tell you what indexes you need for the test data, but that is all.

    It is especially fatal to use very small test data sets. While selecting 1000 out of 100000 rows could be a candidate for an index, selecting 1 out of 100 rows will hardly be, because the 100 rows probably fit within a single disk page, and there is no plan that can beat sequentially fetching 1 disk page.

    链接地址: http://www.djcxy.com/p/87218.html

    上一篇: 对Postgres字符串数组不敏感的索引

    下一篇: 杜松子酒指数不起作用