Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gUXke-0005As-O9 for pgsql-general@arkaria.postgresql.org; Wed, 05 Dec 2018 14:02:08 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gUXkd-0008VD-CR for pgsql-general@arkaria.postgresql.org; Wed, 05 Dec 2018 14:02:07 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gUXkc-0008V6-Uz for pgsql-general@lists.postgresql.org; Wed, 05 Dec 2018 14:02:07 +0000 Received: from mail-oi1-x229.google.com ([2607:f8b0:4864:20::229]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gUXkW-0005Zi-5N for pgsql-general@postgresql.org; Wed, 05 Dec 2018 14:02:05 +0000 Received: by mail-oi1-x229.google.com with SMTP id t204so17561084oie.7 for ; Wed, 05 Dec 2018 06:01:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:content-transfer-encoding:mime-version:subject:date:references :to:in-reply-to:message-id; bh=VWQoK5G78i+6/kmPAJHNoHUb/3JGeHg3USxJiRR4UHc=; b=eJDtKY2wvdc1pFJO9y80PkqxQycso3ZmDz5WOFJdi2FSl1QRxs/EZzh7GMSUvWq9GU 8GIZpCT/1EdMtaGaC/MhyIcjJ3FBp/4iUYEYlasO8itgBjasm0a8az7O8MuTLZnB4rPI QDzncg9ZJaJran59Jp5TZ/N7kb4kIlC8V/Ba0BYUVpEPsswxrAnRSsj3AB5VSWCPi6Y0 +Z3g6ofM8+XIhOAGvOdxAIgy3fgSKAbH45PcUEsZAVKkbq4JWDF6j3lfN3LTeHfZDcwp K6sEoAJPsa69dLZq5VrTPc69jBzZZy3mK87oZN9g8QablG9CARunQWlSCtet8TaRq3C/ 136g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:content-transfer-encoding:mime-version :subject:date:references:to:in-reply-to:message-id; bh=VWQoK5G78i+6/kmPAJHNoHUb/3JGeHg3USxJiRR4UHc=; b=hkG7A3Uwt2GABIXKMRSq+nOPEuQ4xgHHB8BTCvZBShqmCIXCFQcIAnqhLY/DWSXhLg OeIrsdfp07+CJPHYG5lhUPI1cfPngB3dOIoyxL9DHPej0ivj4lUIQ0Fursx+3othnYXS 9QKnVBFR1X/IXsOfUXM8/eTJ+w5T5WRgVkoqFk2UblR0z6khPWHcxknCpezX5SAv83y8 YJxY5pfwv/sG9a6IofgVBrQPoFJNdLpsHSMsjqGCe2Om2/dUiLKlb+iFmwoNgtvdDDDb amh142TnJ1SxUwreDcJqGBSMiuYbYdXJIpdfutPYexlBhPiZS5rfRHIPwX/zVsgC7mK0 Zw9A== X-Gm-Message-State: AA+aEWYl5h/tkHotzAfArODsuAFAdj58tlYlGs+bj062skgOq6akuVe+ 5OOf47Xbwkwe3zrfMFOcv+NtxmYv X-Google-Smtp-Source: AFSGD/UqiPN12tBnNtr7uX+l2ofseC/BjeRcjfFsi+gs1ImvXAFbaq3+zzP+qMIgAZcwOCIsCY1nHA== X-Received: by 2002:aca:4805:: with SMTP id v5mr13897398oia.292.1544018519005; Wed, 05 Dec 2018 06:01:59 -0800 (PST) Received: from [192.168.1.65] ([187.147.244.237]) by smtp.gmail.com with ESMTPSA id o189sm7873206oif.23.2018.12.05.06.01.57 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Dec 2018 06:01:58 -0800 (PST) From: Rob Nikander Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 11.5 \(3445.9.1\)) Subject: Re: querying both text and non-text properties Date: Wed, 5 Dec 2018 09:01:57 -0500 References: <917ede32e461b787966bf1825724edc0bd2787ca.camel@cybertec.at> To: Postgres General In-Reply-To: <917ede32e461b787966bf1825724edc0bd2787ca.camel@cybertec.at> Message-Id: <98C9D9E1-D404-47E2-A04A-B41EC2A025E3@gmail.com> X-Mailer: Apple Mail (2.3445.9.1) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk > On Dec 4, 2018, at 4:59 PM, Laurenz Albe = wrote: >=20 > You have two options: >=20 > A combined index: >=20 > CREATE EXTENSION btree_gin; > CREATE INDEX ON fulltext USING gin (to_tsvector('english', doc), = color); >=20 > That is the perfect match for a query with >=20 > WHERE color =3D 'red' AND to_tsvector('german', doc) @@ = to_tsquery('english', 'word'); >=20 > But you can also create two indexes: >=20 > CREATE INDEX ON fulltext USING gin (to_tsvector('english', doc)); > CREATE INDEX ON fulltext (color); >=20 > Then you don't need the extension, and PostgreSQL can still use them = for the search, > either only one of them if the condition is selective enough, or a = "BitmapAnd" of both. Thanks! I will try both these methods and compare the performance. Rob=