Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id E6019A01096 for ; Wed, 30 Nov 2011 12:17:49 -0400 (AST) Received: from nm23-vm6.bullet.mail.ird.yahoo.com ([212.82.109.235]) by magus.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1RVmqw-0003AF-A6 for pgsql-performance@postgresql.org; Wed, 30 Nov 2011 16:17:48 +0000 Received: from [77.238.189.51] by nm23.bullet.mail.ird.yahoo.com with NNFMP; 30 Nov 2011 16:17:33 -0000 Received: from [212.82.108.241] by tm4.bullet.mail.ird.yahoo.com with NNFMP; 30 Nov 2011 16:17:33 -0000 Received: from [127.0.0.1] by omp1006.mail.ird.yahoo.com with NNFMP; 30 Nov 2011 16:17:33 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 668642.60136.bm@omp1006.mail.ird.yahoo.com Received: (qmail 15269 invoked by uid 60001); 30 Nov 2011 16:17:33 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.it; s=s1024; t=1322669853; bh=Dv9E4lLDb1x++nny9+cOkAfVsGDUSEEERZixvkNVjDg=; h=X-YMail-OSG:Received:X-Mailer:Message-ID:Date:From:Reply-To:Subject:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding; b=Wz0M4AIQIVK7R+I9n9oC8Lo9zq3sl0jdsTK9RZc+8A4LY9lmJImrXICSMWpGDj23PcHYEvQ+oITDunkdBJBihjUDP1SjsaDu5SS7KnRL6LFMofdDsXoOSCA337qSwNMUJhk0ZLf5fEIYhnOKLau9e5/XgzJhyVS/0u1hiL9gQ4M= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.it; h=X-YMail-OSG:Received:X-Mailer:Message-ID:Date:From:Reply-To:Subject:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding; b=2szk3luyCbO2WzbnyL3NbT4Bbd8Ms0p7A1xqkdpl2KsaolCkx1Z++FYsCen8dInXxfyWf4/ofjvKLzIxJddGOz5YAKSw6xhFr0QLZYODGL9uPaU9W9drJjktcGZjIzcliFAbpJQVL23OtIzEv4OuRZvTASsg3H39jYpu6hElyYM=; X-YMail-OSG: SjXALNIVM1mZU43uJcGe.IXLY02vXnBLv9R_ouI8nK9q5Go 6sz6iIlfoYDmgVQAwqS3CUjY4w1_s3lMZcIAmj0itXh3wBAq5DvKZ9DS0prB svb1qkcqwJK5I5fbhFkF.L5PR.nXy6VK1I9ZJnMM1BhnudiyaHvIcBefrLq_ qcjNgAn2YcPGCRWbKxQtVJj5L8okqirq0FFWhYn7KNLxx8hIiF9b6FGF417W ely62pm0Wup749WQlx1DFXaEA84YfjYwTbqTYUksiZmXqYdIWaOpzrqMZOxH yugdhWFGzWLBL9nlt907iqrVM9JRpkaU3Wk8_NchWnHV6PHSB6fU37WSWb8A VnvRYxrTNaxWc1VkzMlrwrfeZZESiX30hvNi8MRkE Received: from [85.33.62.89] by web29003.mail.ird.yahoo.com via HTTP; Wed, 30 Nov 2011 16:17:33 GMT X-Mailer: YahooMailWebService/0.8.115.325013 Message-ID: <1322669853.10239.YahooMailNeo@web29003.mail.ird.yahoo.com> Date: Wed, 30 Nov 2011 16:17:33 +0000 (GMT) From: Leonardo Francalanci Reply-To: Leonardo Francalanci Subject: Re: Guidance Requested - Bulk Inserting + Queries To: "benjamin.johnson@getcarbonblack.com" Cc: "pgsql-performance@postgresql.org" MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Pg-Spam-Score: -2.0 (--) X-Archive-Number: 201111/284 X-Sequence-Number: 45795 > We now found (thanks Andres and Snow-Man in #postgresql) that in our=0A> = tests, after the indexes get too large performance drops signficantly=0A> a= nd our system limps forward due to=A0 disk reads (presumably for the=0A> in= dexes).=A0 If we remove the indexes, performance for our entire sample=0A> = test is great and everything is written to postgresql very quickly.=A0 =0AI= t's usually the fact that the data you index is "random" as opposed to, =0A= say, an always incremented value (could be a timestamp, or a sequence) =0At= hat leads to insert problems with btrees.=A0 =0A> My question is, what poss= ible routes can I take where we can have both=0A> fast inserts (with indexe= s removed until the end of the day), but still=0A> allow a user to query ag= ainst today's data? Is this even possible?=A0 One=0A> idea would be possibl= y have hourly tables for today and as soon as we=0A> can try to re-add inde= xes.=A0 =0AYep, that's the only way I've found: use smaller partitions. Tha= t leads =0Ato slower reads (due to the fact that you have to visit more ind= exes to =0Aread the same amount of data). But you'll get faster writes.=A0 = =0A=0A> Another possible solution might be to stream=0A> the data to anothe= r "reader" postgres instance that has indexes,=0A> although I'm not very ve= rsed in replication.=A0 =0AI don't think you can do that.=A0 =0AAnother opt= ion that you have is to use ssd instead of HD for the indexes =0Aonly (that= is, having the indexes in a separate tablespace of ssds). The =0Aproblem i= s that your disks usually can't keep up with the number of =0Arandom writes= it takes to update N "random values" btrees; ssd might help.=A0 =0ACan you= post some numbers, such as # of indexes, # of rows you're trying =0Ato ins= ert per hour etc etc?=A0 =0A=0A