Return-Path: X-Original-To: apmail-cayenne-commits-archive@www.apache.org Delivered-To: apmail-cayenne-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 6039418C36 for ; Thu, 30 Apr 2015 23:47:06 +0000 (UTC) Received: (qmail 48326 invoked by uid 500); 30 Apr 2015 23:47:06 -0000 Delivered-To: apmail-cayenne-commits-archive@cayenne.apache.org Received: (qmail 48305 invoked by uid 500); 30 Apr 2015 23:47:06 -0000 Mailing-List: contact commits-help@cayenne.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cayenne.apache.org Delivered-To: mailing list commits@cayenne.apache.org Received: (qmail 48295 invoked by uid 99); 30 Apr 2015 23:47:06 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 30 Apr 2015 23:47:06 +0000 Date: Thu, 30 Apr 2015 23:47:06 +0000 (UTC) From: "Ari Maniatis (JIRA)" To: commits@cayenne.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (CAY-2005) Improving generated DISTINCT performance on PostgreSQL MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/CAY-2005?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14522499#comment-14522499 ] Ari Maniatis commented on CAY-2005: ----------------------------------- It seems to me that DISTINCT ON is quite a different thing to DISTINCT and just adding the word "ON" isn't a cue for "make my query go faster please" but rather a very different way of executing the query which presupposes a certain ordering. I can't see how that could be extended to a general purpose ORM unless we were able to detect what the first ordering was and suppress the "ON" if that didn't match. > Improving generated DISTINCT performance on PostgreSQL > ------------------------------------------------------ > > Key: CAY-2005 > URL: https://issues.apache.org/jira/browse/CAY-2005 > Project: Cayenne > Issue Type: Improvement > Reporter: Andrus Adamchik > Assignee: Andrus Adamchik > Fix For: 4.0.M3 > > > The problem is described here: http://markmail.org/message/j7alu33vfm7rjeba Auto-generated DISTINCT keyword when translating SelectQuery results in slowdown of PostgreSQL queries (won't be surprised if this affects other DBs as well). Alternative PostgreSQL syntax "DISTINCT ON(id1, id2, ..)" solves the issue. -- This message was sent by Atlassian JIRA (v6.3.4#6332)