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 1jvjlQ-0001gT-Ty for pgsql-general@arkaria.postgresql.org; Wed, 15 Jul 2020 15:56:08 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jvjlP-0003oT-Rj for pgsql-general@arkaria.postgresql.org; Wed, 15 Jul 2020 15:56:07 +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 1jvjlP-0003jT-IZ for pgsql-general@lists.postgresql.org; Wed, 15 Jul 2020 15:56:07 +0000 Received: from mail-pg1-x544.google.com ([2607:f8b0:4864:20::544]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jvjlN-0004Gh-CD for pgsql-general@lists.postgresql.org; Wed, 15 Jul 2020 15:56:06 +0000 Received: by mail-pg1-x544.google.com with SMTP id z5so3280201pgb.6 for ; Wed, 15 Jul 2020 08:56:05 -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-language:content-transfer-encoding; bh=soZR0x3OT7NSa2OFrjPD+8rZfMgj0yMn65QaQ9WNF6I=; b=MXAtqyZt/vV1n0yubhfAdwJDCvPBFcZ2bxzotP6QHZf6CQiKQF13obINdAoK4e8T7H coD64IA0gtQMTOXSofzjJc9/zcfkLtV6Lgvl/YxZsXnxqJxZR9TSn0uchhvRxhC4g1kl roUiqQ6/pYYcjcomTYi+r+82Q+dhjyo5I2ZcHJlIROnlL2OOpY39sTrC4NZn5hMQpyBS AYoWsIsJK1279pe2oE1cqd3o/9K3NK+adGOyQW7GpLy2a0+jmusdJnWkjB99G+b7TQBd lJXveS19N4eWXxhEzYwENRRnLfvrmT1M8DgNo/+Yu7TsXExkX76D0Q4Pa1tg3Yo4DE/o t+BA== 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-language :content-transfer-encoding; bh=soZR0x3OT7NSa2OFrjPD+8rZfMgj0yMn65QaQ9WNF6I=; b=B1m5NG/cPz9pKUnMyR4Yac9viauKmMjw4zBwxYDSJ0y2Ro8T+5gAnB3e+ij0djiM90 WOOJwRl0g1A4YRZ5Yw7SeqG3z8+Ok6bLdwiVXTHfqwaU0TgMz267ubHJTFuHVWGEJ18Y tGBUtk6v34vIS4+1Ytlqkov4qiyhutbt0ObVHhzHY8KGOj30NBiipW+ajYQJZssm+P8V dNbToM68C4IsVlFMtdqb6xMxJw+GW0+Jofv+PtOXqOBcTO97ayQaTZy49LrclF2nbp2P QOURZ8dyD8hcjSPMSX+ZWeAXruDEvJk7YKfFd8hs/AiIMKFagjPSyoRU6YNFx/9hOt8h 0HbA== X-Gm-Message-State: AOAM532n/DZU3VkjhRnOEMrrerjRavUZk05XKzInz72ttbNloj1gcoAJ 8PGXh2Ku7UzLWfcTNXPqjUzybDUJ7GE= X-Google-Smtp-Source: ABdhPJyeGASRB1xsge9i7JHXagktV7A6uwRmpcgpwxVxMOaQyN0vINijO6chnuF+PaG1r8S2ZFSkBw== X-Received: by 2002:a62:347:: with SMTP id 68mr3713933pfd.185.1594828562905; Wed, 15 Jul 2020 08:56:02 -0700 (PDT) Received: from ?IPv6:2601:681:5500:dde0:d0a0:f590:affe:d970? ([2601:681:5500:dde0:d0a0:f590:affe:d970]) by smtp.gmail.com with ESMTPSA id r2sm2426513pfh.106.2020.07.15.08.56.01 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 15 Jul 2020 08:56:02 -0700 (PDT) Subject: Re: 2 million queries against a table To: pgsql-general@lists.postgresql.org References: <3077129.1594827537@sss.pgh.pa.us> From: Rob Sargent Message-ID: Date: Wed, 15 Jul 2020 09:55:59 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: <3077129.1594827537@sss.pgh.pa.us> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-CA Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 7/15/20 9:38 AM, Tom Lane wrote: > Adam Sanchez writes: >> I need to run 2 million queries against a three columns table t >> (s,p,o) which size is 10 billions rows. The data type of each column >> is string. The server has 512G RAM, 32 cores and 14T SSD (RAID 0) > >> Only two types of queries: > >> select s p o from t where s = param >> select s p o from t where o = param > > TBH, this is a pretty silly way to use a SQL database. Put > the probe values into a temporary table (in batches, perhaps) > and do a join. The per-row cost of that sort of approach > will be multiple orders of magnitude smaller than a query > per row. > > regards, tom lane > > I had assumed the OP was planning a performance test for say 2M separate user/requests (perhaps non-unique) rather than asking for the specific 2M records.