Re: Multicolumn index for single-column queries?

2019-04-18 Thread Gavin Flower
On 19/04/2019 14:01, Gavin Flower wrote: [...] Also there will be fewer index entries per block for the multi_index, which is why the I/O count will be higher even in the best case where there is an equal number of rows referenced by each index entry. Not sure why my system had this still i

Re: Multicolumn index for single-column queries?

2019-04-18 Thread Gavin Flower
On 19/04/2019 01:47, Harald Fuchs wrote: Andreas Kretschmer writes: Am 18.04.19 um 08:52 schrieb rihad: Hi. Say there are 2 indexes:     "foo_index" btree (foo_id)     "multi_index" btree (foo_id, approved, expires_at) foo_id is an integer. Some queries involve all three columns in thei

Re: Multicolumn index for single-column queries?

2019-04-18 Thread Gavin Flower
On 19/04/2019 01:47, Harald Fuchs wrote: Andreas Kretschmer writes: Am 18.04.19 um 08:52 schrieb rihad: Hi. Say there are 2 indexes:     "foo_index" btree (foo_id)     "multi_index" btree (foo_id, approved, expires_at) foo_id is an integer. Some queries involve all three columns in thei

Re: Multicolumn index for single-column queries?

2019-04-18 Thread Gavin Flower
On 19/04/2019 02:12, Ron wrote: On 4/18/19 8:45 AM, Gavin Flower wrote: On 19/04/2019 01:24, Ron wrote: On 4/18/19 2:14 AM, Andreas Kretschmer wrote: [snip] (Prefix compression would obviate the need for this question. Then your multi-column index would be *much* smaller.) True, but a mul

Re: Multicolumn index for single-column queries?

2019-04-18 Thread Ron
On 4/18/19 8:45 AM, Gavin Flower wrote: On 19/04/2019 01:24, Ron wrote: On 4/18/19 2:14 AM, Andreas Kretschmer wrote: [snip] (Prefix compression would obviate the need for this question. Then your multi-column index would be *much* smaller.) True, but a multi column index will still be big

Re: Multicolumn index for single-column queries?

2019-04-18 Thread Harald Fuchs
Andreas Kretschmer writes: > Am 18.04.19 um 08:52 schrieb rihad: >> Hi. Say there are 2 indexes: >> >>     "foo_index" btree (foo_id) >> >>     "multi_index" btree (foo_id, approved, expires_at) >> >> >> foo_id is an integer. Some queries involve all three columns in >> their WHERE clauses, some

Re: Multicolumn index for single-column queries?

2019-04-18 Thread Gavin Flower
On 19/04/2019 01:24, Ron wrote: On 4/18/19 2:14 AM, Andreas Kretschmer wrote: Am 18.04.19 um 08:52 schrieb rihad: Hi. Say there are 2 indexes:     "foo_index" btree (foo_id)     "multi_index" btree (foo_id, approved, expires_at) foo_id is an integer. Some queries involve all three columns

Re: Multicolumn index for single-column queries?

2019-04-18 Thread Ron
On 4/18/19 2:14 AM, Andreas Kretschmer wrote: Am 18.04.19 um 08:52 schrieb rihad: Hi. Say there are 2 indexes:     "foo_index" btree (foo_id)     "multi_index" btree (foo_id, approved, expires_at) foo_id is an integer. Some queries involve all three columns in their WHERE clauses, some in

Re: Multicolumn index for single-column queries?

2019-04-18 Thread Laurenz Albe
Andreas Kretschmer wrote: > Am 18.04.19 um 08:52 schrieb rihad: > > Hi. Say there are 2 indexes: > > > > "foo_index" btree (foo_id) > > > > "multi_index" btree (foo_id, approved, expires_at) > > > > > > foo_id is an integer. Some queries involve all three columns in their > > WHERE cla

Re: Multicolumn index for single-column queries?

2019-04-18 Thread Andreas Kretschmer
Am 18.04.19 um 08:52 schrieb rihad: Hi. Say there are 2 indexes:     "foo_index" btree (foo_id)     "multi_index" btree (foo_id, approved, expires_at) foo_id is an integer. Some queries involve all three columns in their WHERE clauses, some involve only foo_id. Would it be ok from general

Re: Multicolumn index for single-column queries?

2019-04-18 Thread Gavin Flower
On 18/04/2019 18:52, rihad wrote: Hi. Say there are 2 indexes:     "foo_index" btree (foo_id)     "multi_index" btree (foo_id, approved, expires_at) foo_id is an integer. Some queries involve all three columns in their WHERE clauses, some involve only foo_id. Would it be ok from general perf

Multicolumn index for single-column queries?

2019-04-17 Thread rihad
Hi. Say there are 2 indexes: "foo_index" btree (foo_id) "multi_index" btree (foo_id, approved, expires_at) foo_id is an integer. Some queries involve all three columns in their WHERE clauses, some involve only foo_id. Would it be ok from general performance standpoint to remove foo_in