You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by Harunobu Oyama <ho...@telensa.com> on 2016/07/13 13:04:32 UTC

Inserting records without querying the relations

Hi,


Does Cayenne provide a way to insert records without querying the records
that the new record refers via its FKs? For example, in
Artist-Painting-Gallery sample in the official getting started guide, is it
possible to insert Painting records without querying Artist or Gallery when
ARTIST_ID and GALLERY_ID are already known and we do are certain that they
are valid? I do not care even if the object created gets unstable as long
as inserting the record succeeds, as it is a part of process to just insert
records. We will discard the object without referring any of its member
once the insertion completes.

As a part of performance testing, I am in the middle of populating 3
billions of records on a table with FKs. What is the fastest Cayenne way to
populate records in such situation?


thank you,
nobu

Re: Inserting records without querying the relations

Posted by Harunobu Oyama <ho...@telensa.com>.
all,

This is to report everyone that the method suggested by John worked and it
has improved the performance a lot.
(Tim to populate 30,000 records has been reduced from 24 seconds to 10
seconds.)

What I did are as following
  (1) added attributes to access the FKs directly to the ObjEntity
  (2) unchecked "Mandatory" checks on the FK fields from the DbEntity

I am not happy with needing step (2), while the FKs have NOT NULL
constraints, but quite happy with the performance improvement.

thanks
nobu





On 13 July 2016 at 14:10, Harunobu Oyama <ho...@telensa.com> wrote:

> John,
>
> Thank you for your swift, took less than 1 minute!, answer.
> I will try the method you suggest.
>
> nobu
>
>
> On 13 July 2016 at 14:07, John Huss <jo...@gmail.com> wrote:
>
>> You can expose the fk directly as an attribute / property of the class and
>> set it. Then if you don't need it going forward you can remove it and just
>> use the relationship.
>> On Wed, Jul 13, 2016 at 8:04 AM Harunobu Oyama <ho...@telensa.com> wrote:
>>
>> > Hi,
>> >
>> >
>> > Does Cayenne provide a way to insert records without querying the
>> records
>> > that the new record refers via its FKs? For example, in
>> > Artist-Painting-Gallery sample in the official getting started guide,
>> is it
>> > possible to insert Painting records without querying Artist or Gallery
>> when
>> > ARTIST_ID and GALLERY_ID are already known and we do are certain that
>> they
>> > are valid? I do not care even if the object created gets unstable as
>> long
>> > as inserting the record succeeds, as it is a part of process to just
>> insert
>> > records. We will discard the object without referring any of its member
>> > once the insertion completes.
>> >
>> > As a part of performance testing, I am in the middle of populating 3
>> > billions of records on a table with FKs. What is the fastest Cayenne
>> way to
>> > populate records in such situation?
>> >
>> >
>> > thank you,
>> > nobu
>> >
>>
>
>

Re: Inserting records without querying the relations

Posted by Harunobu Oyama <ho...@telensa.com>.
John,

Thank you for your swift, took less than 1 minute!, answer.
I will try the method you suggest.

nobu


On 13 July 2016 at 14:07, John Huss <jo...@gmail.com> wrote:

> You can expose the fk directly as an attribute / property of the class and
> set it. Then if you don't need it going forward you can remove it and just
> use the relationship.
> On Wed, Jul 13, 2016 at 8:04 AM Harunobu Oyama <ho...@telensa.com> wrote:
>
> > Hi,
> >
> >
> > Does Cayenne provide a way to insert records without querying the records
> > that the new record refers via its FKs? For example, in
> > Artist-Painting-Gallery sample in the official getting started guide, is
> it
> > possible to insert Painting records without querying Artist or Gallery
> when
> > ARTIST_ID and GALLERY_ID are already known and we do are certain that
> they
> > are valid? I do not care even if the object created gets unstable as long
> > as inserting the record succeeds, as it is a part of process to just
> insert
> > records. We will discard the object without referring any of its member
> > once the insertion completes.
> >
> > As a part of performance testing, I am in the middle of populating 3
> > billions of records on a table with FKs. What is the fastest Cayenne way
> to
> > populate records in such situation?
> >
> >
> > thank you,
> > nobu
> >
>

Re: Inserting records without querying the relations

Posted by John Huss <jo...@gmail.com>.
You can expose the fk directly as an attribute / property of the class and
set it. Then if you don't need it going forward you can remove it and just
use the relationship.
On Wed, Jul 13, 2016 at 8:04 AM Harunobu Oyama <ho...@telensa.com> wrote:

> Hi,
>
>
> Does Cayenne provide a way to insert records without querying the records
> that the new record refers via its FKs? For example, in
> Artist-Painting-Gallery sample in the official getting started guide, is it
> possible to insert Painting records without querying Artist or Gallery when
> ARTIST_ID and GALLERY_ID are already known and we do are certain that they
> are valid? I do not care even if the object created gets unstable as long
> as inserting the record succeeds, as it is a part of process to just insert
> records. We will discard the object without referring any of its member
> once the insertion completes.
>
> As a part of performance testing, I am in the middle of populating 3
> billions of records on a table with FKs. What is the fastest Cayenne way to
> populate records in such situation?
>
>
> thank you,
> nobu
>