From: Matthew Wakeling <matthew@flymine.org>
To: pgsql-performance@postgresql.org
Subject: Re: Tsearch2 Initial Search Speed
Date: Tue, 17 Jun 2008 14:13:27 +0100 (BST)
Message-ID: <Pine.LNX.4.64.0806171407250.3987@aragorn.flymine.org> (raw)
In-Reply-To: <4857A739.5020800@selestial.com>
References: <4856A91F.1020001@selestial.com>
<200806161124.57543@hal.medialogik.com>
<485789C1.3000803@selestial.com>
<485797D4.7010201@selestial.com>
<Pine.LNX.4.64.0806171202130.3987@aragorn.flymine.org>
<48579EB1.8050403@selestial.com>
<Pine.LNX.4.64.0806171228480.3987@aragorn.flymine.org>
<4857A739.5020800@selestial.com>
On Tue, 17 Jun 2008, Howard Cole wrote:
> If I do a query that uses another index, then it uses the index only and
> does not scan the email table.
Not true. It only looks a little bit like that from the explain output.
However, if you look closely:
> Index Scan using email_email_directory_id_idx on email (cost=0.00..129.01 rows=35 width=8)
> Index Cond: (email_directory_id = 1)
> (2 rows)
It's a scan *using* the index, but *on* the table "email". This index scan
is having to read the email table too.
> The scan on the fts index takes 6 seconds, which presumably returns
> email_id's (the email_id being the primary key) - what does it then need
> from the email table that takes 22 seconds?
Actually, the index returns page numbers in the table on disc which may
contain one or more rows that are relevant. Postgres has to fetch the
whole row to find out the email_id and any other information, including
whether the row is visible in your current transaction (concurrency
control complicates it all). Just having a page number isn't much use to
you!
Matthew
--
First law of computing: Anything can go wro
sig: Segmentation fault. core dumped.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-performance@postgresql.org
Cc: matthew@flymine.org
Subject: Re: Tsearch2 Initial Search Speed
In-Reply-To: <Pine.LNX.4.64.0806171407250.3987@aragorn.flymine.org>
References: <4856A91F.1020001@selestial.com> <200806161124.57543@hal.medialogik.com> <485789C1.3000803@selestial.com> <485797D4.7010201@selestial.com> <Pine.LNX.4.64.0806171202130.3987@aragorn.flymine.org> <48579EB1.8050403@selestial.com> <Pine.LNX.4.64.0806171228480.3987@aragorn.flymine.org> <4857A739.5020800@selestial.com> <Pine.LNX.4.64.0806171407250.3987@aragorn.flymine.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox