Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lyHcR-0001Bc-1z for pgsql-general@arkaria.postgresql.org; Tue, 29 Jun 2021 17:33:55 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lyHcP-0005vH-T4 for pgsql-general@arkaria.postgresql.org; Tue, 29 Jun 2021 17:33:53 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lyHcP-0005v9-Hg for pgsql-general@lists.postgresql.org; Tue, 29 Jun 2021 17:33:53 +0000 Received: from mail-oo1-xc2c.google.com ([2607:f8b0:4864:20::c2c]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1lyHcL-0007vF-Hs for pgsql-general@lists.postgresql.org; Tue, 29 Jun 2021 17:33:52 +0000 Received: by mail-oo1-xc2c.google.com with SMTP id bc18-20020a0568201692b029024c6dbc2073so2804813oob.8 for ; Tue, 29 Jun 2021 10:33:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding:content-language; bh=i2MY1m05flNcKOAXUpEbpQ1d2s+pWR5GmupUJRsvgrM=; b=glQBGjBC9l3ogEHFM8nzWRQYgxMfrcKBrHnBi0CSBMEijppfQgpk2pRC9YAQY+BLeF 8Xt1iIIrYnA8evQfnygCzPBLemsaExTzRXk7w+49oeQoPMNiigw4JgWw4R/ARiI0b5dH r4Elt0GJV/Jxhg8MnwPzbqPN00gEspMNetTbFRerRoy9o5sCvqunrXljAmQkx2i4Mtjm QwGQQ7t5avGyb8BZiPbU5SQuJjO1Ve/iaqRlIQQ6gPonJ296fHQoPlGeEe2uhA9gGAGS DcC9tKLxI4IAu0wxc8gLHpK12cGIFnlwARZOGM7DWwvm1rd6et1bV08aC4xnNc5Erz4a Tw1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=i2MY1m05flNcKOAXUpEbpQ1d2s+pWR5GmupUJRsvgrM=; b=SQz15GJ/xseqVYHiYXfVY0r0WERUqkzpycsOQwOQ7JjuTcyMxu8VoRl4/06NOzQrnL VIxKpUBt501i8n6tzp9Uh1zaF3WZ1C/m0NIL2+RGmdPgRDFF/C9inc630zo7HvK29zXT 6auun/4A4+Dt0A2eGmrqlignpvXQKDIY2x2KvCd/mQjaGxM5zprMU7nrCte1mHhjRfpR ZegW15P7JpjK7JjMJu15r7CTwBcT7otlq9ThyhpDJQO7U0ipmdxOJGWMrSVWwSPoCjIZ uYJ73NfiP0e5QF6aEiChFHf3gx5OR98ALLYBvpPWr+TC2yqwHUWN3QEJ6hZdL3PJplej Mhaw== X-Gm-Message-State: AOAM533/wnldWa2I+KxU/Q0ttYfds6td7cDxvNwLdAcHCyGmm03PmluO qBc8/1vgAAz74oqhi91h4qokqXIA0HNBhg== X-Google-Smtp-Source: ABdhPJxNENi4yqqdaSyi0KnX13l+HXxG6uiHwfbh6f0+5i20kKtf7nf1lAV/4JuHnpyOdTChdeOBSQ== X-Received: by 2002:a4a:8584:: with SMTP id t4mr2049272ooh.12.1624988028020; Tue, 29 Jun 2021 10:33:48 -0700 (PDT) Received: from [192.168.88.10] (ip174-67-141-204.no.no.cox.net. [174.67.141.204]) by smtp.googlemail.com with ESMTPSA id t21sm4287645otd.35.2021.06.29.10.33.46 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 29 Jun 2021 10:33:47 -0700 (PDT) Subject: Re: Do table-level CHECK constraints affect the query optimizer? To: PostgreSQL General References: <5f718120-a286-71ca-3d31-7bad70f0194e@gmail.com> <374d530d-ec98-f1ea-8d41-21e661aa9ab4@gmail.com> <449566.1624984976@sss.pgh.pa.us> From: Ron Message-ID: <69232971-4992-6df9-d629-d45e8a176526@gmail.com> Date: Tue, 29 Jun 2021 12:33:46 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <449566.1624984976@sss.pgh.pa.us> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 6/29/21 11:42 AM, Tom Lane wrote: > Ron writes: >> On 6/29/21 10:41 AM, Michael Lewis wrote: >>> What's an example query that uses indexes on test and does not on live? >> SELECT COUNT(*) FROM sep_info_report_extract; >> On prod, there's a list of "Parallel Seq Scan on xxxx_partname" records in >> the EXPLAIN output, while the test system has a list of "Parallel Index Only >> Scan using ..._idx" records. > It'd be worth checking pg_class.relallvisible page counts for the > partitions on both systems. Lots of 0 records in prod, and lots of "numbers" in test. > If an IOS is possible, the main thing > that might push the planner to do a seqscan instead is if it thinks > that too little of the table is all-visible, which would tend to > inflate the index-only scan towards the same cost as a regular index > scan (which'll almost always be considered slower than seqscan). > > If there's a significant difference in relallvisible fractions, that > would point to something different in your VACUUM housekeeping on > the two systems. Prod is brand new.  Loaded on Saturday; we saw this problem on Sunday during pre-acceptance.  Thus, while running ANALYZE was top of the list of Things To Do, running VACUUM was low. Is that a mistaken belief? -- Angular momentum makes the world go 'round.