Re: "Slow" query or just "Bad hardware"? - Mailing list pgsql-performance

From Matthew
Subject Re: "Slow" query or just "Bad hardware"?
Date
Msg-id Pine.LNX.4.64.0803271559120.20402@aragorn.flymine.org
Whole thread Raw
In response to "Slow" query or just "Bad hardware"?  ("Jesper Krogh" <jesper@krogh.cc>)
List pgsql-performance
On Thu, 27 Mar 2008, Jesper Krogh wrote:
> # explain analyze SELECT "me"."created", "me"."created_initials",
> "me"."updated", "me"."updated_initials", "me"."start_time",
> "me"."end_time", "me"."notes", "me"."id", "me"."sequence_id",
> "me"."database", "me"."name", "numbers"."reference_id",
> "numbers"."evidence" FROM "reference" "me" LEFT JOIN "number" "numbers" ON
> ( "numbers"."reference_id" = "me"."id" ) WHERE ( "me"."sequence_id" IN (
> 34284, 41503, 42274, 42285, 76847, 78204, 104721, 126279, 274770, 274790,
> 274809, 305346, 307383, 307411, 309691, 311362, 344930, 352530, 371033,
> 371058, 507790, 517521, 517537, 517546, 526883, 558976, 4894317, 4976383,
> 1676203, 4700800, 688803, 5028679, 5028694, 5028696, 5028684, 5028698,
> 5028701, 5028676, 5028682, 5028686, 5028692, 5028689, 3048683, 5305427,
> 5305426, 4970187, 4970216, 4970181, 4970208, 4970196, 4970226, 4970232,
> 4970201, 4970191, 4970222, 4350307, 4873618, 1806537, 1817367, 1817432,
> 4684270, 4981822, 3172776, 4894299, 4894304, 4700798, 1120990, 4981817,
> 4831109, 4831036, 4831068, 4831057, 4831105, 4831038, 4831044, 4831081,
> 4831063, 4831051, 4831086, 4831049, 4831071, 4831075, 4831114, 4831093,
> 2635142, 4660208, 4660199, 4912338, 4660150, 4662011, 5307782, 4894286,
> 4894292, 4894296, 4894309, 4894313, 1428388, 1932290, 5306082, 2010148,
> 3979647, 4382006, 4220374, 1880794, 1526588, 774838, 1377100, 969316,
> 1796618, 1121046, 4662009, 963535, 5302610, 1121105, 688700, 688743,
> 688836, 688763, 688788, 1056859, 2386006, 2386015, 2386023, 4265832,
> 4231262, 4265743, 5302612, 1121056, 1121090, 1121074, 688659, 688650 ) )
> ORDER BY "ecnumbers"."reference_id";

Looks like a very reasonable performance, given that the database is
having to seek nearly a thousand times to collect the data from where it
is scattered over the disc. We had a thread a while ago about using aio or
fadvise to speed this sort of thing up (with some really really good
initial test results). Greg, is this still in active consideration?

You don't say if there is much write traffic, and what sort of order the
data gets written to the tables. It may be a significant benefit to
cluster the tables on sequence id or reference id. If you have lots of
write traffic make sure you recluster every now and again. Experiment with
that, and see if it helps.

Matthew

--
The only secure computer is one that's unplugged, locked in a safe,
and buried 20 feet under the ground in a secret location...and i'm not
even too sure about that one.                         --Dennis Huges, FBI

pgsql-performance by date:

Previous
From: "Jesper Krogh"
Date:
Subject: "Slow" query or just "Bad hardware"?
Next
From: PFC
Date:
Subject: Re: "Slow" query or just "Bad hardware"?