Re: optimizing SQL's w/ multiple (and variable) range based predicates against very wide table

  • From: "Mark J. Bobak" <mark@xxxxxxxxx>
  • To: cstephens16@xxxxxxxxx
  • Date: Fri, 25 Jan 2019 11:59:08 -0500

I would consider taking the groups of columns you come up with, but build
(partitioned?) multi-column indexes on those groups.  Then the queries
would be able to (hopefully) select the appropriate index for optimal
tuning.  I'd stay away from "skinny tables", as even with infrequent DML, I
think maintenance would quickly become a nightmare.

If the table really does have no DML (or extremely infrequent DML), then
I'd consider bitmap indexes, one per column eligible for predicates, and
let the optimizer do it's bitmap operations to come up with an optimal plan.

Just my thoughts...

-Mark

On Fri, Jan 25, 2019 at 11:12 AM Chris Stephens <cstephens16@xxxxxxxxx>
wrote:

Oracle 12.2.0.1 3 node RAC on Centos 7.

We have a very wide table (182 columns) with ~400 million rows and a
single column surrogate PK. There is very little DML against the table if
any.

Most of those columns are subject to range based predicates. It is sort of
a discovery table open to ad hoc SQL which makes targeted optimization a
-challenge-. As you can imagine response time isn't awesome for the vast
majority of SQL.

The table is currently range partitioned and sub-partitioned on 2 columns
frequently used in range based filters. There are tons of local indexes.

I'm not sure how frequently this partitioning/indexing strategy helps vs
hurts (new database to me) but after looking at a few SQL's, i don't think
this helps in vast majority of cases.

I'm wondering if there are any general approaches to something like this.

I've only just begun to look at this but my first thought is to try and
figure out groups of columns that often get filtered on together and create
some partitioned "skinny" tables with those columns along with the
surrogate key. I think that would allow us to optimize for up to 3 range
based predicates (partition, subpartition, local index) against each table
and join on key. Is that sane?

What other options are there?

Would inMemory help w/ something like this (we aren't currently licensed)?

Any feedback is greatly appreciated!

Thanks,
Chris


Other related posts: