Re: Why Postgres doesn't use TID scan?

From: Rick Otten <rottenwindfish(at)gmail(dot)com>
To: greatvovan(at)gmail(dot)com
Cc: andrew(at)tao11(dot)riddles(dot)org(dot)uk, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-performance(at)lists(dot)postgresql(dot)org
Subject: Re: Why Postgres doesn't use TID scan?
Date: 2018-12-20 13:46:04
Message-ID: CAMAYy4KC+epqkZLgxgyv+hy9Cwp+RwjuaO_7mb0HhPZC+74TrQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Wed, Dec 19, 2018 at 6:45 PM Vladimir Ryabtsev <greatvovan(at)gmail(dot)com>
wrote:

> > The fundamental issue is that "ANY" has two meanings in PG, one of them
> following the SQL standard and one not:
>
> Oh yes, I was aware about two forms but it did not come into my mind, I
> was thinking I use the same form in both cases since my query returns only
> one row and column.
> Thanks for pointing me into that.
>
> --
> Vlad
>

For what it is worth, I have found that if I am checking for the presence
of an object in an array, while this syntax is easy to understand and more
intuitive to craft:

select
*
from
mytable
where
' test' = ANY (my_varchar_array_column)
;

This syntax is almost always much faster:

select
*
from
mytable
where
ARRAY['test'::varchar] <@ my_varchar_array_column
;

(Since this is a performance list after all.)

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Merlin Moncure 2018-12-20 16:46:42 Re: pgbench results arent accurate
Previous Message Vladimir Ryabtsev 2018-12-19 23:44:58 Re: Why Postgres doesn't use TID scan?