phoenix-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James Taylor <jamestay...@apache.org>
Subject Re: how to avoid full scan
Date Tue, 28 Jun 2016 05:04:12 GMT
Hi,
One way to forbid a full table scan, is to have your own client which
compiles the query first (you'd need to dip down under JDBC -- see
QueryComilerTest.getQueryPlan() for an example) to get the QueryPlan. You
can then easily detect if it's a full table scan looking at the ScanRanges
from queryPlan.getContext().getScanRanges(). With a full table scan,
scanRanges.getBoundSlotCount()==0.

For most queries (non join, non union queries), you could even get an
estimate of the number of bytes that will be scanned using
BaseQueryPlan.getEstimatedByteCount(). FWIW, we have an open JIRA to add
this method to QueryPlan. Using this mechanism, you could even allow a full
table scan based on the max number of bytes that will be scanned.

This would be a good feature to add to Phoenix IMHO. Please file a JIRA.
One word of caution - the above APIs aren't public and will change with our
5.0 release. There will be an equivalent, but different way of getting the
same information, though.

Thanks,
James



On Tue, Jun 28, 2016 at 5:10 AM, jinzhuan@wacai.com <jinzhuan@wacai.com>
wrote:

> hi,
> Our hbase cluster is often over load because of a careless phoenix full
> scan.
> Is there anything I can do to void this?
>
> I want to forbid full scan on specified table. How to do it?
>
> ------------------------------
> jinzhuan@wacai.com
>

Mime
View raw message