X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A3907528BE for ; Tue, 7 Jun 2005 03:55:52 -0300 (ADT) 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 47613-02 for ; Tue, 7 Jun 2005 06:55:43 +0000 (GMT) Received: from matrix.gatewaynet.com (matrix.gatewaynet.com [217.19.69.50]) by svr1.postgresql.org (Postfix) with ESMTP id BDDCF5289E for ; Tue, 7 Jun 2005 03:55:41 -0300 (ADT) Received: from matrix.gatewaynet.com (localhost.localdomain [127.0.0.1]) by matrix.gatewaynet.com (8.12.8/8.12.8) with ESMTP id j576ex9W016722; Tue, 7 Jun 2005 09:40:59 +0300 Received: from localhost (achill@localhost) by matrix.gatewaynet.com (8.12.8/8.12.8/Submit) with ESMTP id j576exB4016718; Tue, 7 Jun 2005 09:40:59 +0300 Date: Tue, 7 Jun 2005 09:40:59 +0300 (EEST) From: Achilleus Mantzios To: "ON.KG" Cc: Richard Huxton , pgsql-sql Subject: Re: What is faster? In-Reply-To: <52585625.20050607112826@on.kg> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=ISO-8859-7 Content-Transfer-Encoding: 8BIT X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.293 tagged_above=0 required=5 tests=AWL, HOT_NASTY X-Spam-Level: X-Archive-Number: 200506/97 X-Sequence-Number: 21698 O ON.KG έγραψε στις Jun 7, 2005 : > RH> ON.KG wrote: > >> Hi All! > >> > >>>>What is faster - SLECTion data from one large table (200 000 - 300 000 > >>>>records), or SELECTion from a few small tables (example, 2 tables 150 > >>>>000 records each)? > >> > >> For example i have two large tables > >> Structure of tables is same - has two fields - id, ip > >> > >> Now i'm using two selection from each in one transaction > >> Each of them selects only one record > >> selection clase like WHERE ip = 'xxx.xxx.xxx.xxx' > >> so it is searches existance of IP in each table > >> > >> tables are clustered > > RH> OK - so the tables aren't updated frequently, I assume. Do you have an > RH> index on "ip"? > > Yes > > >> about cached in RAM - i'm novice in Postgresql - how does it work? > > RH> The operating-system will keep frequently used disk-blocks in memory. > RH> You don't have to do anything. Have you done any performance tuning in > RH> your postgresql.conf file? If not, try reading: > RH> http://www.powerpostgresql.com/PerfList > > Server Administrator says, he did > > >> now i need to make much faster as it is possible > >> and have an idea just merge two tables in one - will it help me? > > RH> If they hold the same information, they probably shouldn't have been > RH> split in the first place. > > Content of tables is not absolutely same > One has one kind of IPs, second - others > > And there's one more addition in question - if I will merge tables, > in new table will be set new additional field - `type` char - to > determine type of IP > > Thank You Just a thought, also you could try if converting your ip from varchar(32) to int8 (unsigned int4) would make any difference, since the index on int8 would be more efficient. > > > ---------------------------(end of broadcast)--------------------------- > TIP 9: the planner will ignore your desire to choose an index scan if your > joining column's datatypes do not match > -- -Achilleus