You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "garpinc (JIRA)" <ji...@apache.org> on 2012/09/21 16:23:07 UTC

[jira] [Created] (OPENJPA-2265) An unnecessary select statement appears to be occurring on primary key table

garpinc created OPENJPA-2265:
--------------------------------

             Summary: An unnecessary select statement appears to be occurring on primary key table
                 Key: OPENJPA-2265
                 URL: https://issues.apache.org/jira/browse/OPENJPA-2265
             Project: OpenJPA
          Issue Type: Bug
          Components: jdbc
    Affects Versions: 2.2.0
            Reporter: garpinc


This issue pertains to http://openjpa.208410.n2.nabble.com/Can-someone-explain-this-OpenJPA-trace-td7580862.html

Basically I'm seeing an unnecessary select statement of the form:
1487  test  TRACE  [main] openjpa.jdbc.SQL - <t 1920940938, conn 488448102> executing prepstmnt 163450945 SELECT t0.otherField1, t0.uniqueField1 FROM KeyClass t0 WHERE t0.pk = ? [params=(long) 0]

My application does millions of these so performance is suffering. I'll be attaching a test case to illustrate. testselect0.zip

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (OPENJPA-2265) An unnecessary select statement appears to be occurring on primary key table

Posted by "Rick Curtis (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-2265?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13460663#comment-13460663 ] 

Rick Curtis commented on OPENJPA-2265:
--------------------------------------

Try persisting your key before the master. 

The extra select is when we cascade the relationship from Master->Key and we don't know if the other side is new or existing.
                
> An unnecessary select statement appears to be occurring on primary key table
> ----------------------------------------------------------------------------
>
>                 Key: OPENJPA-2265
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2265
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jdbc
>    Affects Versions: 2.2.0
>            Reporter: garpinc
>         Attachments: testselect0.zip
>
>
> This issue pertains to http://openjpa.208410.n2.nabble.com/Can-someone-explain-this-OpenJPA-trace-td7580862.html
> Basically I'm seeing an unnecessary select statement of the form:
> 1487  test  TRACE  [main] openjpa.jdbc.SQL - <t 1920940938, conn 488448102> executing prepstmnt 163450945 SELECT t0.otherField1, t0.uniqueField1 FROM KeyClass t0 WHERE t0.pk = ? [params=(long) 0]
> My application does millions of these so performance is suffering. I'll be attaching a test case to illustrate. testselect0.zip

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (OPENJPA-2265) An unnecessary select statement appears to be occurring on primary key table

Posted by "Rick Curtis (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-2265?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13460734#comment-13460734 ] 

Rick Curtis commented on OPENJPA-2265:
--------------------------------------

I'm giving you a workaround as I don't see myself getting dedicated time to fix this issue. That being said it is nearly identical to a JIRA[1] I fixed a long time back, but it must be a slightly different path.

[1] https://issues.apache.org/jira/browse/OPENJPA-1986
                
> An unnecessary select statement appears to be occurring on primary key table
> ----------------------------------------------------------------------------
>
>                 Key: OPENJPA-2265
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2265
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jdbc
>    Affects Versions: 2.2.0
>            Reporter: garpinc
>         Attachments: testselect0.zip
>
>
> This issue pertains to http://openjpa.208410.n2.nabble.com/Can-someone-explain-this-OpenJPA-trace-td7580862.html
> Basically I'm seeing an unnecessary select statement of the form:
> 1487  test  TRACE  [main] openjpa.jdbc.SQL - <t 1920940938, conn 488448102> executing prepstmnt 163450945 SELECT t0.otherField1, t0.uniqueField1 FROM KeyClass t0 WHERE t0.pk = ? [params=(long) 0]
> My application does millions of these so performance is suffering. I'll be attaching a test case to illustrate. testselect0.zip

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (OPENJPA-2265) An unnecessary select statement appears to be occurring on primary key table

Posted by "garpinc (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-2265?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

garpinc updated OPENJPA-2265:
-----------------------------

    Attachment: testselect0.zip

test case to try is the testSelect0 one. When run in the console you will see the select in the trace right after the last alter table 
                
> An unnecessary select statement appears to be occurring on primary key table
> ----------------------------------------------------------------------------
>
>                 Key: OPENJPA-2265
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2265
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jdbc
>    Affects Versions: 2.2.0
>            Reporter: garpinc
>         Attachments: testselect0.zip
>
>
> This issue pertains to http://openjpa.208410.n2.nabble.com/Can-someone-explain-this-OpenJPA-trace-td7580862.html
> Basically I'm seeing an unnecessary select statement of the form:
> 1487  test  TRACE  [main] openjpa.jdbc.SQL - <t 1920940938, conn 488448102> executing prepstmnt 163450945 SELECT t0.otherField1, t0.uniqueField1 FROM KeyClass t0 WHERE t0.pk = ? [params=(long) 0]
> My application does millions of these so performance is suffering. I'll be attaching a test case to illustrate. testselect0.zip

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (OPENJPA-2265) An unnecessary select statement appears to be occurring on primary key table

Posted by "garpinc (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-2265?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13474237#comment-13474237 ] 

garpinc commented on OPENJPA-2265:
----------------------------------

FYI: With  snapshot openjpa-2.2.1-20121010.180151-3.jar
I'm now seeing for the workaround which makes the work around unusable for that version

The instance of type "class com.cambridgesemantics.anzo.relationalreplicator.jpa.model.AnzoURIToPKImpl" with oid "null" no longer exists in the data store.  This may mean that you deleted the instance in a separate transaction, but this context still has a cached version.
                
> An unnecessary select statement appears to be occurring on primary key table
> ----------------------------------------------------------------------------
>
>                 Key: OPENJPA-2265
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2265
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jdbc
>    Affects Versions: 2.2.0
>            Reporter: garpinc
>         Attachments: testselect0.zip
>
>
> This issue pertains to http://openjpa.208410.n2.nabble.com/Can-someone-explain-this-OpenJPA-trace-td7580862.html
> Basically I'm seeing an unnecessary select statement of the form:
> 1487  test  TRACE  [main] openjpa.jdbc.SQL - <t 1920940938, conn 488448102> executing prepstmnt 163450945 SELECT t0.otherField1, t0.uniqueField1 FROM KeyClass t0 WHERE t0.pk = ? [params=(long) 0]
> My application does millions of these so performance is suffering. I'll be attaching a test case to illustrate. testselect0.zip

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (OPENJPA-2265) An unnecessary select statement appears to be occurring on primary key table

Posted by "garpinc (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-2265?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13460684#comment-13460684 ] 

garpinc commented on OPENJPA-2265:
----------------------------------

Can you clarify? 

1) First of all the Key's @Id value is null so that should indicate that it's new and also if since the object hasn't been been retrieved from db then also it's new right?
2) Are you considering this a bug and providing me with a workaround or is this the final solution?


                
> An unnecessary select statement appears to be occurring on primary key table
> ----------------------------------------------------------------------------
>
>                 Key: OPENJPA-2265
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2265
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jdbc
>    Affects Versions: 2.2.0
>            Reporter: garpinc
>         Attachments: testselect0.zip
>
>
> This issue pertains to http://openjpa.208410.n2.nabble.com/Can-someone-explain-this-OpenJPA-trace-td7580862.html
> Basically I'm seeing an unnecessary select statement of the form:
> 1487  test  TRACE  [main] openjpa.jdbc.SQL - <t 1920940938, conn 488448102> executing prepstmnt 163450945 SELECT t0.otherField1, t0.uniqueField1 FROM KeyClass t0 WHERE t0.pk = ? [params=(long) 0]
> My application does millions of these so performance is suffering. I'll be attaching a test case to illustrate. testselect0.zip

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira