You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@syncope.apache.org by Guido Wimmel <gu...@gmx.net> on 2015/02/10 08:22:09 UTC

minor optimization for content loading

Hi,

I noticed an inefficiency in the code for loading content.xml:
before every insert, the whole table content seems to be read just to
get the metadata - see ContentLoaderHandler.getParameters():

57         Map<String, Integer> colTypes = jdbcTemplate.query("SELECT * FROM " + tableName,
58                 new ResultSetExtractor<Map<String, Integer>>() {

...

This usually shouldn't be a big problem, but could be awkward if one e.g. wants to use this
mechanism to insert large amounts of test data, or if it is used during migration from 1.1 -> 1.2
to insert records into tables which are already filled.

I suggest adding "WHERE 0=1". I tried this and it does not affect the build and integration test.

If it's ok, I can make the corresponding change - but I'd need to know if I should open a JIRA,
and if there's anything special to consider when merging from 1.2 because of the code reorganization
(SYNCOPE-620).

WDYT?

Cheers,
  Guido

Re: minor optimization for content loading

Posted by Francesco Chicchiriccò <il...@apache.org>.
On 10/02/2015 08:22, Guido Wimmel wrote:
> Hi,
>
> I noticed an inefficiency in the code for loading content.xml:
> before every insert, the whole table content seems to be read just to
> get the metadata - see ContentLoaderHandler.getParameters():
>
> 57         Map<String, Integer> colTypes = jdbcTemplate.query("SELECT * FROM " + tableName,
> 58                 new ResultSetExtractor<Map<String, Integer>>() {
>
> ...
>
> This usually shouldn't be a big problem, but could be awkward if one e.g. wants to use this
> mechanism to insert large amounts of test data, or if it is used during migration from 1.1 -> 1.2
> to insert records into tables which are already filled.
>
> I suggest adding "WHERE 0=1". I tried this and it does not affect the build and integration test.
>
> If it's ok, I can make the corresponding change - but I'd need to know if I should open a JIRA,
> and if there's anything special to consider when merging from 1.2 because of the code reorganization
> (SYNCOPE-620).
>
> WDYT?

Cool stuff, I like optimizations! :-)

Please open an issue on JIRA with fix-for-version 1.2.3 (1_2_X) & 1.3.0 
(master): I'll take care of merging into the 2_0_X feature branch.

Regards.

-- 
Francesco Chicchiriccò

Tirasa - Open Source Excellence
http://www.tirasa.net/

Involved at The Apache Software Foundation:
member, Syncope PMC chair, Cocoon PMC, Olingo PMC
http://people.apache.org/~ilgrosso/