Search Postgresql Archives

Re: Planner statistics usage for composite type

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Dmitry Lazurkin <dilaz03@xxxxxxxxx> 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.

Yeah, that's because eval_const_expressions doesn't know how to fold
a constant RowExpr to a simple Const.  I have a patch laying about
someplace to improve that, but I keep forgetting about it until
we're in beta phase :-(.  In the meantime you could perhaps do the
folding by hand:

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)

			regards, tom lane


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux