Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hSqaN-000077-JV for pgsql-performance@arkaria.postgresql.org; Mon, 20 May 2019 22:16:47 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hSqaK-0002ob-1e for pgsql-performance@arkaria.postgresql.org; Mon, 20 May 2019 22:16:44 +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_SHA1:256) (Exim 4.89) (envelope-from ) id 1hSqaJ-0002oT-Kt for pgsql-performance@lists.postgresql.org; Mon, 20 May 2019 22:16:43 +0000 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hSqaF-0002ft-5s for pgsql-performance@lists.postgresql.org; Mon, 20 May 2019 22:16:42 +0000 Received: by mail-wr1-x442.google.com with SMTP id b18so16226070wrq.12 for ; Mon, 20 May 2019 15:16:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=SoLPy17HsWms+qxUSXY2zM4gvggTiCdQhPASJuil9wY=; b=WIxHmX5AxhmmDgxv+70jIwcUk7sc7vfntNbk6gbsG0sOtK8cSM+nOGEkPzjEOU2JPL +uapwHpV7EcY0gbjH/96TGWmX0X5fZUCPYtCgm9lBsejLVH1U13b7lVRCoEaQA0N63mt i4J+pVTQejMPiEDeG1f0o+v9MGzD0nP0AH3VNz8qsn++mHI5WWfeTamBhZH2LkTYwlVD HdFFzTrElqkIvMKsHhMNFchOWBSs1va5zpl+CMkRuRcAC5WbjIuTyK3mhwoaLODFWnND WzpnFp1R5fs+KkIyevfVaPDckUlAOD0N5UsfHAa6IO+VzszyXvNKyEt6R9+z9GSiMRrd 3cdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=SoLPy17HsWms+qxUSXY2zM4gvggTiCdQhPASJuil9wY=; b=hP2xdw4453BOjg2HH1N+agteSSJ2ZkVGYAiQbAZfCB7GHIwFBToVJKTtEcEirYmtee FTgQh7Sa7u4mBPl1BEjmi4mylqK13qtkfJm5KsqR2T4jEopmHAq7sFOPCYSVKwP2C9EX oKV6Nao2IdNGs8JjLh1crbqjW9uaih3k5lgTIE5+wHu5O+9OS5rEVA2Q9pbFVG6/Uf9b sJaODiSzyxRM7qXD7uthXlcLkLgXiWy/L636A8ThxXHAdqdiNoXMYfxcTgLjQRSDkXyc wf5zor4VPA/zQ2jhmJ1KvAsIACRER2ibV0M6uS4SOOi8LouvLeOlCuZoRSIcf5fim1sZ A+Pg== X-Gm-Message-State: APjAAAUV08CTP6aFrwb2KdmTaGcyqd6Ddm5lujyVtuTDOkwTrC7jD77B +xuJ48Qh6WT8BQKV4gnHvcfKFw== X-Google-Smtp-Source: APXvYqz5HYzsgcbDrxeTNbzngpyu/WAySNjZDQob2U+IKk7kZ8ZGtcSlos6Z/O3oP9c9eoTDU9Ttcg== X-Received: by 2002:adf:ec8c:: with SMTP id z12mr37678301wrn.209.1558390596958; Mon, 20 May 2019 15:16:36 -0700 (PDT) Received: from localhost (ip-86-49-243-43.net.upcbroadband.cz. [86.49.243.43]) by smtp.gmail.com with ESMTPSA id t66sm1510083wmf.39.2019.05.20.15.16.33 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 20 May 2019 15:16:33 -0700 (PDT) Date: Tue, 21 May 2019 00:16:31 +0200 From: Tomas Vondra To: Deepak Somaiya Cc: Tom Lane , Bruce Momjian , "david@kineticode.com" , "Naik, Sameer" , "pgsql-performance@lists.postgresql.org" Subject: Re: Generic Plans for Prepared Statement are 158155 times slower than Custom Plans Message-ID: <20190520221631.6i47hwyodfqdk2ym@development> References: <20190429133607.3jh7bqx4vznuhok7@momjian.us> <22414.1556548539@sss.pgh.pa.us> <16b3416fb88b48a382df0145bdd76f19@hou-exmbprd-03.adprod.bmc.com> <670927089.1909643.1557375255783@mail.yahoo.com> <4e741138fe5944b68328a05bf095f68e@hou-exmbprd-03.adprod.bmc.com> <1460161008.2800629.1558388254959@mail.yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1; format=flowed Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1460161008.2800629.1558388254959@mail.yahoo.com> User-Agent: NeoMutt/20180716-1444-295967 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Mon, May 20, 2019 at 09:37:34PM +0000, Deepak Somaiya wrote: > wow this is interesting!  >@Tom, Bruce, David - Experts >Any idea why would changing the datatype would cause so much degradation - this is even when plan remains the same ,data is same. >Deepak > On Friday, May 17, 2019, 2:36:05 AM PDT, Naik, Sameer wrote: > > >Deepak, > >I changed the datatype from citext to text and now everything works fine. > >The data distribution is same, plan is same, yet there is a huge performance degradation when citext is used instead of text. > >However the business case requires case insensitive string handling. > >I am looking forward to some expert advice here when dealing with citext data type. > > It's generally a good idea to share explain analyze output for both versions of the query - both with citext and text. regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services