Re: substring on bit(n) and bytea types is slow

From: Arjen Nienhuis <a(dot)g(dot)nienhuis(at)gmail(dot)com>
To: Evgeny Morozov <evgeny(dot)morozov+list+pgsql(at)shift-technology(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: substring on bit(n) and bytea types is slow
Date: 2016-03-01 23:33:15
Message-ID: CAG6W84K_WeGeXc0KY7csygh+3XftRaz4J40x3Wc-QC-r+y6=xg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Feb 29, 2016 22:26, "Evgeny Morozov" <
evgeny(dot)morozov+list+pgsql(at)shift-technology(dot)com> wrote
> SELECT substring(bitarray from (32 * (n - 1) + 1) for 32) -- bitarray is
a column of type bit(64000000)
> FROM array_test_bit
> JOIN generate_series(1, 10000) n ON true;

Substring on a bit string is not optimized for long TOASTed values.
Substring on text is optimized for that. The current code fetches the whole
8MB from the table every time.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message drum.lucas@gmail.com 2016-03-02 01:39:15 Re: Schema Size
Previous Message drum.lucas@gmail.com 2016-03-01 23:33:04 Re: Function fixing - PostgreSQL 9.2