Re: Understanding "seq scans"

Alvaro Herrera <alvherre@2ndquadrant.com>

From: Alvaro Herrera <alvherre@2ndquadrant.com>
To: Lele Gaifax <lele@metapensiero.it>
Cc: pgsql-general@postgresql.org
Date: 2015-10-12T22:13:09Z
Lists: pgsql-general
Lele Gaifax wrote:
> Hi all,
> 
> I'm doing some experiments to find the better layout for reimplementing
> an existing db (MySQL cough!) with PostgreSQL 9.4+.
> 
> I noticed a strange plan coming out from a simple query joining two tables,
> both containing 10Mrecs (and both ANALYZEd):

>              ->  Bitmap Index Scan on l10n_text_index  (cost=0.00..64549.19 rows=999662 width=0)
>                    Index Cond: ((lower(text) ~>=~ 'quattro'::text) AND (lower(text) ~<~ 'quattrp'::text))

So 10% of your rows in the master_l10n table start with "quattro"?
That's pretty odd, isn't it?  How did you manufacture these data?

I wonder if the l10n_text_index index should be on (lang, lower(text)).
How often are you going to look for translated text without specifying a
language?

-- 
Álvaro Herrera                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services