Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1boRHc-0001Kw-E2 for pgsql-performance@arkaria.postgresql.org; Mon, 26 Sep 2016 08:29:04 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1boRHb-0005Hb-Nj for pgsql-performance@arkaria.postgresql.org; Mon, 26 Sep 2016 08:29:03 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1boRHa-0005FL-Mw for pgsql-performance@postgresql.org; Mon, 26 Sep 2016 08:29:03 +0000 Received: from mail-lf0-x22e.google.com ([2a00:1450:4010:c07::22e]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1boRHX-0003T1-5t for pgsql-performance@postgresql.org; Mon, 26 Sep 2016 08:29:01 +0000 Received: by mail-lf0-x22e.google.com with SMTP id g62so133292803lfe.3 for ; Mon, 26 Sep 2016 01:28:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=8kdata-com.20150623.gappssmtp.com; s=20150623; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding; bh=QQJ4P+E+MFxJ3TvC4AFVN9BOpuxfjjCuabXLQW+IgIQ=; b=V+csHCXsBJI1sqWqdgE6TwTBA4jv8E6VW0mWRZ1UXtwyKEZQ2z81v7kjE4OS5TPzjf KDlDlUkAaBf8WLLqSh1nMSmhs8ztw7nUF2t29PeSrgJK9TN8jv5ZE0ijlxCNuKrTGXyt Ht2LR07KOeqrz0WoJRDvUWjzARNQuxGFOblvWAXbrjlsy5yC5/zconcOHQURhAJKzgPw 1VnW1rgg7+vcXbKbAzyU4CIVYBA1FSU39qfwkhYvz26Gipr//Cg+I+00TmdpSWAPIhFf QEFH8o+/fLwhypG59ib6e1buh+ryFEjiy3QYbZwUmJuaOruFCpUxSRxBS5v7x7pGe535 KMKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=QQJ4P+E+MFxJ3TvC4AFVN9BOpuxfjjCuabXLQW+IgIQ=; b=SyzF9YKg3e7wJLbtcoCEefhMtVydH4WCyvDnB+BDhIWstq8Tgrq6eTDM9X6zEOnZGE +LqXSWxlH3qeJKlkDS1jc/Qy1/obMvcIC+ztZQTRQ9G/IyMLgpEkq1mWBbNQD7MCr52S sPY1EwzivgMf+brcoS0ef1wBbNqgQiNObAlOXOLXeZRWlod9ujPEuCWlzl4XH3m0NTG/ EWiFBVukJOlk1/4YicVLYwttkqveJXUCIaHUljvZOF6tLscWnnioWIqaBdFB3WTOthMu PVBeotFB7ZIbwlwKWDtI/iip/nC7SGIMYoy1GSxhocFM3qVeHDjndHw9ASwvHjq2r5yl k32Q== X-Gm-Message-State: AA6/9RlZpykEI9pKiBGt4tMxaJizIUCLc79t/rHxhQTzTbeoloopYfZPNazIr7/x9HcvoA== X-Received: by 10.25.44.80 with SMTP id s77mr362615lfs.18.1474878536274; Mon, 26 Sep 2016 01:28:56 -0700 (PDT) Received: from [192.168.128.104] (h86-62-119-132.ln.rinet.ru. [86.62.119.132]) by smtp.gmail.com with ESMTPSA id s70sm3528738lfi.23.2016.09.26.01.28.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 26 Sep 2016 01:28:55 -0700 (PDT) Subject: Re: Millions of tables To: Greg Spiegelberg , "pgsql-performa." References: From: =?UTF-8?Q?=c3=81lvaro_Hern=c3=a1ndez_Tortosa?= Message-ID: <7413c596-f2e0-77eb-ad6c-0ce456fc2665@8kdata.com> Date: Mon, 26 Sep 2016 11:28:54 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Pg-Spam-Score: -1.8 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-performance Precedence: bulk Sender: pgsql-performance-owner@postgresql.org On 26/09/16 05:50, Greg Spiegelberg wrote: > Hey all, > > Obviously everyone who's been in PostgreSQL or almost any RDBMS for a > time has said not to have millions of tables. I too have long > believed it until recently. > > AWS d2.8xlarge instance with 9.5 is my test rig using XFS on EBS (io1) > for PGDATA. Over the weekend, I created 8M tables with 16M indexes on > those tables. Table creation initially took 0.018031 secs, average > 0.027467 and after tossing out outliers (qty 5) the maximum creation > time found was 0.66139 seconds. Total time 30 hours, 31 minutes and > 8.435049 seconds. Tables were created by a single process. Do note > that table creation is done via plpgsql function as there are other > housekeeping tasks necessary though minimal. > > No system tuning but here is a list of PostgreSQL knobs and switches: > shared_buffers = 2GB > work_mem = 48 MB > max_stack_depth = 4 MB > synchronous_commit = off > effective_cache_size = 200 GB > pg_xlog is on it's own file system > > There are some still obvious problems. General DBA functions such as > VACUUM and ANALYZE should not be done. Each will run forever and > cause much grief. Backups are problematic in the traditional pg_dump > and PITR space. Large JOIN's by VIEW, SELECT or via table inheritance > (I am abusing it in my test case) are no-no's. A system or database > crash could take potentially hours to days to recover. There are > likely other issues ahead. > > You may wonder, "why is Greg attempting such a thing?" I looked at > DynamoDB, BigTable, and Cassandra. I like Greenplum but, let's face > it, it's antiquated and don't get me started on "Hadoop". I looked at > many others and ultimately the recommended use of each vendor was to > have one table for all data. That overcomes the millions of tables > problem, right? > > Problem with the "one big table" solution is I anticipate 1,200 > trillion records. Random access is expected and the customer expects > <30ms reads for a single record fetch. > > No data is loaded... yet Table and index creation only. I am > interested in the opinions of all including tests I may perform. If > you had this setup, what would you capture / analyze? I have a job > running preparing data. I did this on a much smaller scale (50k > tables) and data load via function allowed close to 6,000 > records/second. The schema has been simplified since and last test > reach just over 20,000 records/second with 300k tables. > > I'm not looking for alternatives yet but input to my test. Takers? > > I can't promise immediate feedback but will do my best to respond with > results. > > TIA, > -Greg Hi Greg. This is a problem (creating a large number of tables; really large indeed) that we researched in my company a while ago. You might want to read about it: https://www.pgcon.org/2013/schedule/events/595.en.html Cheers, Álvaro -- Álvaro Hernández Tortosa ----------- 8Kdata -- Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance