Re: What is faster?

From: Achilleus Mantzios <achill(at)matrix(dot)gatewaynet(dot)com>
To: "ON(dot)KG" <skyer(at)on(dot)kg>
Cc: Richard Huxton <dev(at)archonet(dot)com>, pgsql-sql <pgsql-sql(at)postgresql(dot)org>
Subject: Re: What is faster?
Date: 2005-06-07 06:40:59
Message-ID: Pine.LNX.4.44.0506070937590.16686-100000@matrix.gatewaynet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Volkan YAZICI 2005-06-07 06:41:22 Re: large object support in PostGres 7.4
Previous Message Vadivel Subramaniam 2005-06-07 06:20:16 large object support in PostGres 7.4