pg.ddx.io pgsql-docs@postgresql.org mailing list archive
help / color / mirror / Atom feedintarray - benefits over regular int[]?
4+ messages / 4 participants
[nested] [flat]
* intarray - benefits over regular int[]?
@ 2017-08-21 19:33 theconor@gmail.com
0 siblings, 1 reply; 4+ messages in thread
From: theconor@gmail.com @ 2017-08-21 19:33 UTC (permalink / raw)
To: pgsql-docs
The following documentation comment has been logged on the website:
Page: https://www.postgresql.org/docs/10/static/intarray.html
Description:
Would it be possible for the intarray documentation to describe its benefits
over regular int[]?
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?
Thanks for any clarifications that can be given.
--
Sent via pgsql-docs mailing list (pgsql-docs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-docs
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: intarray - benefits over regular int[]?
@ 2017-08-21 20:02 David G. Johnston <david.g.johnston@gmail.com>
parent: theconor@gmail.com
0 siblings, 1 reply; 4+ messages in thread
From: David G. Johnston @ 2017-08-21 20:02 UTC (permalink / raw)
To: theconor@gmail.com; +Cc: pgsql-docs
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.
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: intarray - benefits over regular int[]?
@ 2017-08-22 21:12 Conor McNally <theconor@gmail.com>
parent: David G. Johnston <david.g.johnston@gmail.com>
0 siblings, 1 reply; 4+ messages in thread
From: Conor McNally @ 2017-08-22 21:12 UTC (permalink / raw)
To: David G. Johnston <david.g.johnston@gmail.com>; +Cc: 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.
>
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: intarray - benefits over regular int[]?
@ 2017-08-23 03:12 Tom Lane <tgl@sss.pgh.pa.us>
parent: Conor McNally <theconor@gmail.com>
0 siblings, 0 replies; 4+ messages in thread
From: Tom Lane @ 2017-08-23 03:12 UTC (permalink / raw)
To: Conor McNally <theconor@gmail.com>; +Cc: David G. Johnston <david.g.johnston@gmail.com>; pgsql-docs
Conor McNally <theconor@gmail.com> writes:
> 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?
TBH, I think that intarray is legacy code that we haven't got around to
replacing completely, but the handwriting is on the wall. No one has put
any meaningful development effort into it in years; rather, the action
has been in improving the core code's array functionality. And there are
definitely gotchas involved in using it without care. Because it offers
variant versions of some of the same operator names defined by the core,
you can get cases where a query will not use an index because the query
is using the extension's <@ operator where the index is for the core <@
operator, or vice versa. (See list archives for many complaints of
this kind.)
If you can show that use of intarray offers life-changing improvements
for your application over what the core code can do for you, then by
all means use it. If it doesn't offer strong, measurable improvements,
I counsel against getting involved with it.
regards, tom lane
--
Sent via pgsql-docs mailing list (pgsql-docs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-docs
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2017-08-23 03:12 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2017-08-21 19:33 intarray - benefits over regular int[]? theconor@gmail.com
2017-08-21 20:02 ` David G. Johnston <david.g.johnston@gmail.com>
2017-08-22 21:12 ` Conor McNally <theconor@gmail.com>
2017-08-23 03:12 ` Tom Lane <tgl@sss.pgh.pa.us>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox