Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 697A86326D0 for ; Thu, 7 Jan 2010 09:59:14 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 49281-01 for ; Thu, 7 Jan 2010 13:58:55 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.171]) by mail.postgresql.org (Postfix) with ESMTP id 7E23963297B for ; Thu, 7 Jan 2010 09:59:03 -0400 (AST) Received: from webserv.wug.de ([194.25.154.138]) by mrelayeu.kundenserver.de (node=mreu2) with ESMTP (Nemesis) id 0MJHCg-1NVcys2j9u-002lpN; Thu, 07 Jan 2010 14:59:01 +0100 Received: from kretschmer by webserv.wug.de with local (Exim 3.36 #1) id 1NSstA-0003BQ-00 for pgsql-performance@postgresql.org; Thu, 07 Jan 2010 14:59:00 +0100 Date: Thu, 7 Jan 2010 14:59:00 +0100 From: "A. Kretschmer" To: pgsql-performance@postgresql.org Subject: Re: Air-traffic benchmark Message-ID: <20100107135900.GC9884@a-kretschmer.de> References: <852badbc1001070438j36eb10d3qa22398ffcbef405f@mail.gmail.com> <20100107133225.GB9884@a-kretschmer.de> <852badbc1001070540v6f4f799dyae246d39977fa34f@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <852badbc1001070540v6f4f799dyae246d39977fa34f@mail.gmail.com> X-OS: Debian/GNU Linux - weil ich es mir Wert bin! User-Agent: Mutt/1.5.9i X-Provags-ID: V01U2FsdGVkX189ugGHKpbmvOVQMbK/HcJjwYeESIXw4zKB2zp 3BaXaMFK1PNzb1b3ZKkfs59mKwsXKoc0d+F8afmacKSbofoXnr VVxlQ7XDIR+frFI/aZepQ== X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-0.903 tagged_above=-10 required=5 tests=AWL=-0.718, BAYES_40=-0.185 X-Spam-Level: X-Archive-Number: 201001/88 X-Sequence-Number: 36968 In response to Lefteris : > Thank you all for your answers! > > Andrea, I see the other way around what you are saying: > > Sort (cost=7407754.12..7407754.13 rows=4 width=2) (actual > time=371188.821..371188.823 rows=7 loops=1) > Seq Scan on ontime (cost=0.00..7143875.40 rows=52775727 width=2) > (actual time=190938.959..346180.079 rows=52484047 loops=1) > > > I dont see the seq scan to ba a problem, and it is the correct choice > here because Year spans from 1999 to 2009 and the query asks from 2000 > and on, so PG correctly decides to use seq scan and not index access. Thats right. But this is not a contradiction, this seq-scan *is* the real problem, not the sort. And yes, as others said, increment the work_mem isn't the solution. It is counterproductive, because you lost buffer-cache. Andreas, note the 's' at the end ;-) -- Andreas Kretschmer Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: -> Header) GnuPG: 0x31720C99, 1006 CCB4 A326 1D42 6431 2EB0 389D 1DC2 3172 0C99