Re: Hash partitioning.

Поиск
Список
Период
Сортировка
Искать
От
Robert Haas
Тема
Re: Hash partitioning.
Дата
Msg-id
CA+TgmoZrX+fuFpR0vShMJj+CmB2QzJRRrBwO9d8ZvY4Jad6QYw@mail.gmail.com
Ответ на
Re: Hash partitioning. (Bruce Momjian)
Список
Дерево обсуждения
Hash partitioning. "Yuri Levinsky" <yuril@celltick.com>
Re: Hash partitioning. Bruce Momjian <bruce@momjian.us>
Re: Hash partitioning. "Yuri Levinsky" <yuril@celltick.com>
Re: Hash partitioning. Bruce Momjian <bruce@momjian.us>
Re: Hash partitioning. Robert Haas <robertmhaas@gmail.com>
Re: Hash partitioning. Bruce Momjian <bruce@momjian.us>
Re: Hash partitioning. Robert Haas <robertmhaas@gmail.com>
Re: Hash partitioning. Bruce Momjian <bruce@momjian.us>
Re: Hash partitioning. Tom Lane <tgl@sss.pgh.pa.us>
Re: Hash partitioning. Bruce Momjian <bruce@momjian.us>
Re: Hash partitioning. Robert Haas <robertmhaas@gmail.com>
Re: Hash partitioning. "Yuri Levinsky" <yuril@celltick.com>
Re: Hash partitioning. Alvaro Herrera <alvherre@2ndquadrant.com>
Re: Hash partitioning. Christopher Browne <cbbrowne@gmail.com>
Re: Hash partitioning. Tom Lane <tgl@sss.pgh.pa.us>
Re: Hash partitioning. "Yuri Levinsky" <yuril@celltick.com>
Re: Hash partitioning. Heikki Linnakangas <hlinnakangas@vmware.com>
Re: Hash partitioning. Tom Lane <tgl@sss.pgh.pa.us>
Re: Hash partitioning. "Yuri Levinsky" <yuril@celltick.com>
Re: Hash partitioning. Heikki Linnakangas <hlinnakangas@vmware.com>
Re: Hash partitioning. Bruce Momjian <bruce@momjian.us>
Re: Hash partitioning. Claudio Freire <klaussfreire@gmail.com>
Re: Hash partitioning. Jeff Janes <jeff.janes@gmail.com>
Re: Hash partitioning. Claudio Freire <klaussfreire@gmail.com>
Re: Hash partitioning. "Yuri Levinsky" <yuril@celltick.com>
Re: Hash partitioning. Nicolas Barbier <nicolas.barbier@gmail.com>
Re: Hash partitioning. Markus Wanner <markus@bluegap.ch>
Re: Hash partitioning. Nicolas Barbier <nicolas.barbier@gmail.com>
Re: Hash partitioning. Markus Wanner <markus@bluegap.ch>
Re: Hash partitioning. Jeff Janes <jeff.janes@gmail.com>
Re: Hash partitioning. Jeff Janes <jeff.janes@gmail.com>
Re: Hash partitioning. Nicolas Barbier <nicolas.barbier@gmail.com>
Re: Hash partitioning. Ants Aasma <ants.aasma@eesti.ee>
Re: Hash partitioning. Claudio Freire <klaussfreire@gmail.com>
Re: Hash partitioning. Claudio Freire <klaussfreire@gmail.com>
Re: Hash partitioning. Kevin Grittner <kgrittn@ymail.com>
Re: Hash partitioning. Bruce Momjian <bruce@momjian.us>
Re: Hash partitioning. Markus Wanner <markus@bluegap.ch>
Re: Hash partitioning. Kevin Grittner <kgrittn@ymail.com>
Re: Hash partitioning. Heikki Linnakangas <hlinnakangas@vmware.com>
Re: Hash partitioning. Markus Wanner <markus@bluegap.ch>
Re: Hash partitioning. "Yuri Levinsky" <yuril@celltick.com>
Re: Hash partitioning. Jeff Janes <jeff.janes@gmail.com>
Re: Hash partitioning. Markus Wanner <markus@bluegap.ch>
Re: Hash partitioning. "ktm@rice.edu" <ktm@rice.edu>
Re: Hash partitioning. Markus Wanner <markus@bluegap.ch>
Re: Hash partitioning. Bruce Momjian <bruce@momjian.us>
Re: Hash partitioning. "Yuri Levinsky" <yuril@celltick.com>
Re: Hash partitioning. Markus Wanner <markus@bluegap.ch>
Re: Hash partitioning. Jeff Janes <jeff.janes@gmail.com>
Re: Hash partitioning. Claudio Freire <klaussfreire@gmail.com>
On Tue, Jun 25, 2013 at 11:06 AM, Bruce Momjian  wrote:
>> Not really.  Constraint exclusion won't kick in for a constraint like
>> CHECK (hashme(a) % 16 == 3) and a WHERE clause of the form  a = 42.
>
> Uh, I thought we checked the constant against every CHECK constraint and
> only scanned partitions that matched.  Why does this not work?

That's a pretty fuzzy description of what we do.  For this to work,
we'd have to be able to use the predicate a = 42 to prove that
hashme(a) % 16 = 3 is false.  But we can't actually substitute 42 in
for a and then evaluate hashme(42) % 16  = 3, because we don't know
that the a = 42 in the WHERE clause means exact equality for all
purposes, only that it means "has the numerically same value".  For
integers, equality under = is sufficient to prove equivalence.

But for numeric values, for example, it is not.  The values
'42'::numeric and '42.0'::numeric are equal according to =(numeric,
numeric), but they are not the same.  If the hashme() function did
something like length($1::text), it would get different answers for
those two values.  IOW, the theorem prover has no way of knowing that
the hash function provided has semantics that are compatible with the
opclass of the operator used in the query.

>> Of course, since partitioning generally doesn't improve performance in
>> PostgreSQL anyway, it's not clear why you'd want to do this in the
>
> I think partitioning does improve performance by reducing index depth.

Generally, I think traversing an extra level of the index is cheaper
than opening extra relations and going through the theorem-prover
machinery.  There are benefits to partitioning, but they have to do
with management - e.g. each partition can be vacuumed independently;
old partitions can be dropped more efficiently than you can
bulk-delete rows spread throughout a table - rather than performance.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


В списке pgsql-hackers по дате отправления
От: Andrew Dunstan
Дата:
От: Cédric Villemain
Дата:
FAQ