From: Adam Lang <aalang@rutgersinsurance.com>
To: PostgreSQL PHP <pgsql-php@postgresql.org>
Subject: Re: Fooling the query optimizer
Date: Thu, 8 Feb 2001 11:26:03 -0500
Message-ID: <013a01c091eb$d4e20c20$330a0a0a@rutgersinsurance.com> (raw)
References: <20010208154156.9447813AB5@ml-samba.mdc.mlhs.org>
Let me look into this.
Adam Lang
Systems Engineer
Rutgers Casualty Insurance Company
http://www.rutgersinsurance.com
----- Original Message -----
From: "Brent R.Matzelle" <bmatzelle@yahoo.com>
To: "PostgreSQL PHP" <pgsql-php@postgresql.org>
Sent: Thursday, February 08, 2001 10:41 AM
Subject: [PHP] Fooling the query optimizer
> Have any of you discovered a way to get around the current query optimizer
> limitation in Postgres? For example, I have a table that has three
columns
> that I want to index for frequent search duties. In Postgres I am forced
to
> create three indicies: one including all three columns, one for col2 and
> col3, and one for just col3. Databases like MySQL can use the first index
> for these types of queries "SELECT * WHERE col2 = x AND col3 = y" and
"SELECT
> * WHERE col3 = y". Postgres could only perform queries on indicies where
it
> looks like "SELECT * WHERE col1 = x AND col2 = y AND col3 = z" and "SELECT
*
> WHERE col1 = x AND col2 = y" etc. However adding extra indexes as above
> would decrease the write speed on that table because a simple insert would
> require an update on all three indicies.
>
> Is there a way to fool Postgres to use the first index by creating a query
> like "SELECT * WHERE col1 = * AND col3 = x"? I know I'm grasping for
straws
> here, but these issues can kill my database query performance.
>
> Brent
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-php@postgresql.org
Cc: aalang@rutgersinsurance.com
Subject: Re: Fooling the query optimizer
In-Reply-To: <013a01c091eb$d4e20c20$330a0a0a@rutgersinsurance.com>
References: <20010208154156.9447813AB5@ml-samba.mdc.mlhs.org> <013a01c091eb$d4e20c20$330a0a0a@rutgersinsurance.com>
* 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