Clarity in partial index example.

Started by PG Bug reporting formabout 7 years ago4 messagesdocs
Jump to latest
#1PG Bug reporting form
noreply@postgresql.org

The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/11/indexes-partial.html
Description:

The example illustrating when a partial index can and cannot be used is a
little misleading. The query which can use the partial index is:
SELECT *
FROM access_log
WHERE url = '/index.html' AND client_ip = inet '212.78.10.32';

and the query which can't use the partial index is:
SELECT *
FROM access_log
WHERE client_ip = inet '192.168.100.23';

Maybe I am misunderstanding the concept here but url = '/index.html' doesn't
have any effect on this? If that's the case I would suggest either removing
it from the first query or adding it to the second query.

#2Jonathan S. Katz
jkatz@postgresql.org
In reply to: PG Bug reporting form (#1)
Re: Clarity in partial index example.

On 4/3/19 4:20 PM, PG Doc comments form wrote:

The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/11/indexes-partial.html
Description:

The example illustrating when a partial index can and cannot be used is a
little misleading. The query which can use the partial index is:
SELECT *
FROM access_log
WHERE url = '/index.html' AND client_ip = inet '212.78.10.32';

and the query which can't use the partial index is:
SELECT *
FROM access_log
WHERE client_ip = inet '192.168.100.23';

Maybe I am misunderstanding the concept here but url = '/index.html' doesn't
have any effect on this? If that's the case I would suggest either removing
it from the first query or adding it to the second query.

You're correct, the url = '/index.html' does not affect if the partial
index is used in the example.

Based on how the example is set up, I'd propose using the "url"
parameter in both examples. I've attached a patch that does this, with
some additional wording around the examples.

Thanks,

Jonathan

Attachments:

0001-Use-consistent-examples-of-queries-demonstrating-whe.patchtext/plain; charset=UTF-8; name=0001-Use-consistent-examples-of-queries-demonstrating-whe.patch; x-mac-creator=0; x-mac-type=0Download+4-3
#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Jonathan S. Katz (#2)
Re: Clarity in partial index example.

"Jonathan S. Katz" <jkatz@postgresql.org> writes:

On 4/3/19 4:20 PM, PG Doc comments form wrote:

Maybe I am misunderstanding the concept here but url = '/index.html' doesn't
have any effect on this? If that's the case I would suggest either removing
it from the first query or adding it to the second query.

You're correct, the url = '/index.html' does not affect if the partial
index is used in the example.

Based on how the example is set up, I'd propose using the "url"
parameter in both examples. I've attached a patch that does this, with
some additional wording around the examples.

Yeah, this seems unnecessarily confusing. I tweaked your extra wording
a bit --- I didn't like referring to the index as covering a range,
because it's really excluding a range not including one.

Pushed.

regards, tom lane

#4Jonathan S. Katz
jkatz@postgresql.org
In reply to: Tom Lane (#3)
Re: Clarity in partial index example.

On 4/3/19 6:30 PM, Tom Lane wrote:

"Jonathan S. Katz" <jkatz@postgresql.org> writes:

On 4/3/19 4:20 PM, PG Doc comments form wrote:

Maybe I am misunderstanding the concept here but url = '/index.html' doesn't
have any effect on this? If that's the case I would suggest either removing
it from the first query or adding it to the second query.

You're correct, the url = '/index.html' does not affect if the partial
index is used in the example.

Based on how the example is set up, I'd propose using the "url"
parameter in both examples. I've attached a patch that does this, with
some additional wording around the examples.

Yeah, this seems unnecessarily confusing. I tweaked your extra wording
a bit --- I didn't like referring to the index as covering a range,
because it's really excluding a range not including one.

You're right, that makes sense.

Pushed.

Thanks!

Jonathan