Обсуждение: compile cube extension with float4 precision storing

Поиск
Список
Период
Сортировка

compile cube extension with float4 precision storing

От
Siarhei D
Дата:
Is it possible to make cube extension with float(4bytes) precision instead of double(8bytes)?

I use cube extension for storing embedding vectors and calculation distance on them. During comparing vectors, a 4byte float precision is enough. Storing 8 byte double precision is wasting disk space.

Now to avoid disk wasting I store vectors as real[] array and create cube objects on the fly. But this solution is wasting cpu time

--

Siarhei Damanau

Re: compile cube extension with float4 precision storing

От
Tomas Vondra
Дата:
On Fri, Jun 12, 2020 at 02:41:08PM +0300, Siarhei D wrote:
>Is it possible to make cube extension with float(4bytes) precision instead
>of double(8bytes)?
>
>I use cube extension for storing embedding vectors and calculation distance
>on them. During comparing vectors, a 4byte float precision is enough.
>Storing 8 byte double precision is wasting disk space.
>
>Now to avoid disk wasting I store vectors as real[] array and create cube
>objects on the fly. But this solution is wasting cpu time
>

I don't think there's a built-in support for that, so the only option I
can think of is creating your own cube "copy" extension using float4.

regards

-- 
Tomas Vondra                  http://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services