Re: Huge Data

From: Richard Huxton <dev(at)archonet(dot)com>
To: Sezai YILMAZ <sezai(dot)yilmaz(at)pro-g(dot)com(dot)tr>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Huge Data
Date: 2004-01-14 13:18:45
Message-ID: 200401141318.45658.dev@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wednesday 14 January 2004 12:39, Sezai YILMAZ wrote:
>
> select logid, agentid, logbody from log where logid=3000000;

At a guess, because logid is bigint, whereas 300000 is taken to be integer.
Try ... where logid = 300000::bigint;

This is in the FAQ too I think, and is certainly in the archives.

Other things you might come across:
SELECT max() involves a sequential scan just like count(), you can rewrite it
as SELECT target_column FROM my_table ORDER BY target_column DESC LIMIT 1

The config values are very conservative. You will definitely want to tune them
for performance. See the articles here for a good introduction:
http://www.varlena.com/varlena/GeneralBits/Tidbits/index.php

The VACUUM command is used to reclaim unused space, and the ANALYZE command to
regenerate statistics. It's worth reading up on both.

You can use EXPLAIN ANALYSE <query here> to see the plan that PG uses. I think
there's a discussion of it at http://techdocs.postgresql.org/

--
Richard Huxton
Archonet Ltd

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Richard Huxton 2004-01-14 13:19:46 Re: Huge Data
Previous Message Együd Csaba 2004-01-14 13:16:25 Re: Using regular expressions in LIKE