Re: Planner statistics usage for composite type

From: Dmitry Lazurkin <dilaz03(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Planner statistics usage for composite type
Date: 2017-07-20 10:26:45
Message-ID: db8ab519-ad99-fb81-7471-00571536d213@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 07/19/2017 06:37 PM, Tom Lane wrote:
> Dmitry Lazurkin <dilaz03(at)gmail(dot)com> writes:
>> I am trying to find workaround for cross-column statistics.
>> ...
>> Worn estimate. Planner doesn't use statistics. In code I see usage of
>> function scalargtsel which returns default selectivity because
>> ROW('tag1', 0.9)::tag_sim is not Const.
> regression=# EXPLAIN ANALYZE SELECT * FROM tags WHERE ROW(t, s)::tag_sim >= '(tag1,0.9)'::tag_sim AND
> ROW(t, s)::tag_sim <= '(tag1,1.0)'::tag_sim;
> QUERY PLAN
> ----------------------------------------------------------------------------------------------------------------------
> Index Scan using tags_composite on tags (cost=0.29..8.30 rows=1 width=13) (actual time=0.051..0.051 rows=0 loops=1)
> Index Cond: ((ROW(t, s)::tag_sim >= '(tag1,0.9)'::tag_sim) AND (ROW(t, s)::tag_sim <= '(tag1,1)'::tag_sim))
> Planning time: 0.230 ms
> Execution time: 0.110 ms
> (4 rows)

Thank you. (:

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Thomas Kellerer 2017-07-20 11:54:02 _page_cost parameter with values < 1
Previous Message David G. Johnston 2017-07-20 04:28:59 Re: How to stop array_to_json from interpolating column names that weren't there