Re: [DOCS] intarray - benefits over regular int[]? - Mailing list pgsql-docs

From Conor McNally
Subject Re: [DOCS] intarray - benefits over regular int[]?
Date
Msg-id CAN6k=iE=_uum7u_o8K07cUktYLxR1X4B_KyCic2nnFQ4b-DjAA@mail.gmail.com
Whole thread Raw
In response to Re: [DOCS] intarray - benefits over regular int[]?  ("David G. Johnston" <david.g.johnston@gmail.com>)
Responses Re: [DOCS] intarray - benefits over regular int[]?
List pgsql-docs
Thanks,

The line about it being faster gives me the reassurance that I need.  From just the introduction I was unsure of the actual benefit over int[] - the operators look like they can all be replicated using the standard library, albeit in much more convoluted ways!  Is it general advice therefore that if I've got an array of intergers, no nulls, it is advantageous for me to install and use intarray, and I'd really only want to use int[] if I had nulls?  Or is there something more to it?

Kind regards,

Conor

On Mon, Aug 21, 2017 at 9:02 PM, David G. Johnston <david.g.johnston@gmail.com> wrote:
On Mon, Aug 21, 2017 at 12:33 PM, <theconor@gmail.com> wrote:
The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/10/static/intarray.html
Description:
​[...]​
 
At the moment I am a little unclear whether intarray is effectively a
deprecated module, or if it can still provide some distinct advantages -
e.g. performance, features or just a handy syntax -- for new projects too?

​A quick skim of this and the generic array functions/operators documentation shows that numerous functions and operators exist for intarray that do not have equivalents in core.  For that alone I'd say this extension remains not-deprecated.

Its implied that it also performs better, ostensibly because the code need only considered non-null integer arrays whereas the general functions have to consider arrays of all types.  I'm not aware of any recent benchmark runs that would indicate whether improvements to arrays in recent versions of PostgreSQL have narrowed or eliminated that gap.

David J.

pgsql-docs by date:

Previous
From: sahapasci@gmail.com
Date:
Subject: [DOCS] pg_replication_slots page links
Next
From: Peter Eisentraut
Date:
Subject: Re: [DOCS] Mention new `GENERATED … AS IDENTITY` feature in the `Serial Types` page ?