Return-Path: X-Original-To: apmail-openjpa-dev-archive@www.apache.org Delivered-To: apmail-openjpa-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id DEC5B78D6 for ; Sat, 22 Oct 2011 13:28:55 +0000 (UTC) Received: (qmail 35279 invoked by uid 500); 22 Oct 2011 13:28:55 -0000 Delivered-To: apmail-openjpa-dev-archive@openjpa.apache.org Received: (qmail 35221 invoked by uid 500); 22 Oct 2011 13:28:54 -0000 Mailing-List: contact dev-help@openjpa.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@openjpa.apache.org Delivered-To: mailing list dev@openjpa.apache.org Received: (qmail 35212 invoked by uid 99); 22 Oct 2011 13:28:54 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 22 Oct 2011 13:28:54 +0000 X-ASF-Spam-Status: No, hits=-2000.5 required=5.0 tests=ALL_TRUSTED,RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 22 Oct 2011 13:28:52 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 01192316C64 for ; Sat, 22 Oct 2011 13:26:32 +0000 (UTC) Date: Sat, 22 Oct 2011 13:26:32 +0000 (UTC) From: "Moti Nisenson (Created) (JIRA)" To: dev@openjpa.apache.org Message-ID: <285472756.5223.1319289992006.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Created] (OPENJPA-2062) Poor performance for JPQL delete MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org Poor performance for JPQL delete -------------------------------- Key: OPENJPA-2062 URL: https://issues.apache.org/jira/browse/OPENJPA-2062 Project: OpenJPA Issue Type: Bug Components: jpa Affects Versions: 2.0.1 Environment: Derby 10.5.3 Reporter: Moti Nisenson If I have a simple entity as such @Entity public class MyClass { @Id Long id; @Column(name="xyz", nullable=false) Long field; } And I have a JPQL delete query: "delete from MyClass e where e.field=?1" this gets translated into the following sql: DELETE from MyClass where id in (select distinct t0.id from MyClass t0 where (to.xyz = ?)) The extra select with distinct (rather than just having DELETE from MyClass where xyz=?) causes a big performance slowdown; on the order of 5-10x (with Derby 10.5.3). I didn't bother testing for different annotations, but I would imaging it's the same for all of them. Please fix this; it is very basic functionality and the SQL generated should be the straightforward, high performing version. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira