Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fr4AW-00073H-2H for pgsql-general@arkaria.postgresql.org; Sat, 18 Aug 2018 16:33:40 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fr4AT-0006in-La for pgsql-general@arkaria.postgresql.org; Sat, 18 Aug 2018 16:33:37 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fr4AT-0006ia-BW for pgsql-general@lists.postgresql.org; Sat, 18 Aug 2018 16:33:37 +0000 Received: from mail-wm0-x236.google.com ([2a00:1450:400c:c09::236]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1fr4AR-0001eE-9V for pgsql-general@postgresql.org; Sat, 18 Aug 2018 16:33:36 +0000 Received: by mail-wm0-x236.google.com with SMTP id o11-v6so10227845wmh.2 for ; Sat, 18 Aug 2018 09:33:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:references:in-reply-to:subject:date:message-id:mime-version :content-transfer-encoding:content-language:thread-index; bh=anYJhljN9EwEN4hlyUAu85vMQsYEVBks5vaCvpW11+A=; b=FSrQpEVETcqJPlMKFuF5LaYMIipA6ocdUdhSPnBQFsg7w3gNcLEbIlqABMaPIUh6+e rMNOCnWHMPPM99+2yPmRfmL17B3S1C9dy36FRQ3YYoIUB9HP3rPXhRnBTKGd5cqvBM5d VWHk2ztsnFY8XjABotGOIvcr6Xx00bV/Ubk56LuFRlKNLRJu6JAyI8JOaa9RenqdwBHe I/fjkepDg056xBpA/3xBYVwLW1nnIS5FUgdN7j+eG9fAsgUBIhRSJvsiBAQ3H0H6qP9p J/8UpulbUCAmZTvVy/puJKiL4MlSLJjKEMdq4jAhpyzJUsS1eIyIoVneedmBaoAynPY3 ioGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:references:in-reply-to:subject:date :message-id:mime-version:content-transfer-encoding:content-language :thread-index; bh=anYJhljN9EwEN4hlyUAu85vMQsYEVBks5vaCvpW11+A=; b=VeCVloACXhWmlhrNSUxq53yjXdIpJq30Ylan20oqR/jEiKA+m5cXYc7Kg9gxKNmGvc jezdccBXrAenwbM5Yo2zdlNLlUgflUkD5mJVs2vbmJ7IDeCtt6yTqWiMafKf4ryIk1Ec axsZltCTkduKd9TyXoMZUzZ/GH+ZtQ2xhKL6U2nS3vaiFbgMbcwR0O/GWFFROwicUCur QgktFEl480rW/p3b2ZyvsfoS6BYCTgPvA8qMG7fYgPBfq063geKlojGjdeBYUw/KykFz OCvkwf6hiLzXh060jnhjw1ofvdHICkZD/ELj5JmaM/NcpxcjVlYWZ4PfE/uUh1WMPESb VuxA== X-Gm-Message-State: AOUpUlEQ6DLCnO77Ub81l+AMwPRAtsFx8X21ItqVtITCk42eAp6DfDUx yKSTxmajM17QDQfE77ZKRf8u6Z/S X-Google-Smtp-Source: AA+uWPy/Fg62FafjXH4Tqcdk01505cIYXIr3crbaMn9zVB/UrG+k7PbedLGKvrFaH0FQ+olpxdyOCw== X-Received: by 2002:a1c:8414:: with SMTP id g20-v6mr11128417wmd.90.1534610012451; Sat, 18 Aug 2018 09:33:32 -0700 (PDT) Received: from PC016 (mail.ibeq.com. [212.100.42.241]) by smtp.gmail.com with ESMTPSA id n12-v6sm3543781wrm.62.2018.08.18.09.33.31 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 18 Aug 2018 09:33:31 -0700 (PDT) From: To: References: <004b01d436d6$ff96c840$fec458c0$@gmail.com> <807123113.9511341.1534609514205@mail.yahoo.com> In-Reply-To: <807123113.9511341.1534609514205@mail.yahoo.com> Subject: AW: CTE with JOIN of two tables is much faster than a regular query Date: Sat, 18 Aug 2018 18:33:30 +0200 Message-ID: <007201d43711$33120e20$99362a60$@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Outlook 16.0 Content-Language: de Thread-Index: AQMeRW6BypEtj0kC9MzG04zOKiRbkAKicACEohyCw0A= List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk > -----Urspr=C3=BCngliche Nachricht----- > Von: Ravi Krishna > Gesendet: Samstag, 18. August 2018 18:25 >=20 > > What can I do to improve the performance of the regular query = without > using a CTE? >=20 > Why do you care ? When I find that I can write a SQL 3 different = ways, I will > go for the most efficient one. So why not accept the CTE version of = this SQL. > Just curious. We're using object mapping / entity frameworks (e.g. XPO, Entity = Framework Core). These frameworks support regular queries out-of-the = box; a CTEs require additional effort and are more difficult to = maintain.=20 Regards Klaus