X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 28429D70C0 for ; Wed, 9 Nov 2005 13:31:43 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 07795-06 for ; Wed, 9 Nov 2005 17:31:41 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from h6608.serverkompetenz.net (gpg-keyserver.de [81.169.179.29]) by svr1.postgresql.org (Postfix) with ESMTP id 7D7F5D6FCC for ; Wed, 9 Nov 2005 13:31:41 -0400 (AST) Received: from brs9-d9bad87e.pool.mediaways.net ([217.186.216.126] helo=[192.168.0.51]) by h6608.serverkompetenz.net with asmtp (Exim 4.34) id 1EZtnP-0003bi-Kc for pgsql-performance@postgresql.org; Wed, 09 Nov 2005 18:31:39 +0100 Message-ID: <43723257.5060804@web.de> Date: Wed, 09 Nov 2005 18:31:03 +0100 From: Jan Kesten User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: Improving performance on multicolumn query References: <4371E6A7.50808@web.de> <20051109124429.GA9127@uio.no> In-Reply-To: <20051109124429.GA9127@uio.no> X-Enigmail-Version: 0.92.0.0 OpenPGP: id=82201FC4; url=http://gpg-keyserver.de Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/159 X-Sequence-Number: 15416 Hi all! First thanks to any answer by now :-) > You don't post your table definitions (please do), but it looks like > test_b, test_c, test_d and test_e might be bigints? If so, you may > want to do explicit "AND test_b=1::bigint AND test_c=2::bigint" etc. > -- 7.4 doesn't figure this out for you. (8.0 and higher does.) I didn't post table defintion, but you all are right, test_a to test_e are all bigint. I use JDBC to connect to this database and use a prepared statment for the queries and set all parameters with pst.setLong() method. Perhaps this could be the problem? I'll try 'normal' statements with typecasting, because as far as I can see, the query is the problem (postgresql takes more than 98% cpu while running these statements) or the overhead produced (but not the network, as it has only 1-2% load). Quering other tables (not as big - both rows and columns are much less) run quite fast with the same code. So, thanks again - I'll try and report :-) Can't be so slow, I have some self-build database with millions of rows and they run very fast - but they don't use bigint ;-) Cheers, Jan