From: Mike Lewis on 31 Mar 2010 05:08 Woops. I sent the wrong patch. My apologies. Attached is the real patch. Sorry, also forgot this is made against 9.0 alpha 4 tag. Thanks, Mike -- Michael Lewis lolrus.org mikelikespie(a)gmail.com On Wed, Mar 31, 2010 at 12:39 AM, Mike Lewis <mikelikespie(a)gmail.com> wrote: > I noticed while doing work with very large arrays that several > functions such as array_length detoast the entire array instead of > only what is required. > > I found the solution to be just unpacking the header portion of the > array and ignoring the rest. Since the header (including the > dimensions) is variable length, I just unpack the size of what the > header would be if it had MAXDIM dimensions. (Patch is attached) > > I made a test case to demonstrate performance gains (watch out, it > creates a big table): > > create temporary table foo as > select array_agg(i) as a > from ( > select generate_series(1,10000000) as i) as bar; > \timing > select array_length(a, 1) from foo; -- Run a few times. First time will be cold > > Results (after warming up) > > Before patch: > Time: 6.251 ms > Time: 6.078 ms > Time: 5.983 ms > > After patch: > Time: 0.401 ms > Time: 0.397 ms > Time: 0.441 ms > ... > > -- > Michael Lewis > lolrus.org > mikelikespie(a)gmail.com >
From: Robert Haas on 31 Mar 2010 11:28 On Wed, Mar 31, 2010 at 5:08 AM, Mike Lewis <mikelikespie(a)gmail.com> wrote: > Woops. I sent the wrong patch. My apologies. Attached is the real > patch. Sorry, also forgot this is made against 9.0 alpha 4 tag. Neat. Please add it here: https://commitfest.postgresql.org/action/commitfest_view/open ....Robert -- Sent via pgsql-hackers mailing list (pgsql-hackers(a)postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers
From: Mike Lewis on 31 Mar 2010 12:47 On Wed, Mar 31, 2010 at 8:28 AM, Robert Haas <robertmhaas(a)gmail.com> wrote: > > Neat. Please add it here: > > https://commitfest.postgresql.org/action/commitfest_view/open > > ...Robert > Thanks. Added it. https://commitfest.postgresql.org/action/patch_view?id=292 -Mike -- Sent via pgsql-hackers mailing list (pgsql-hackers(a)postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers
|
Pages: 1 Prev: [HACKERS] ECPG pointer vs array Next: ECPG pointer vs array |