Docsity

Adaptive Selectivity Estimation using Query Feedback: A Recursive Approach, Papers of Database Management Systems (DBMS)

Toggle sidebar
bg1
Adaptive Selectivity Estimation Using Query Feedback
Chungmin Melvin Chen
Department of Computer Science
University of Maryland
College Park, MD 20742
Nick Roussopoulos
Department of Computer Science
University of Maryland
College Park, MD 20742
Abstract
In this paper, we propose a novel approach for estimating the
record selectivities of database queries. The real attribute
value distribution is adaptively approximated by a curve-
tting function using a query feedback mechanism. This
approach has the advantages of requiring no extra database
access overhead for gathering statistics and of being able to
continuously adapt the value distribution through queries
and updates. Experimental results show that the estimation
accuracy of this approach is comparable to traditional
methods based on statistics gathering.
1 Introduction
In most database systems, the task of query optimiza-
tion is to choose an ecient execution plan. Best plan
selection requires accurate estimates of the
costs
of al-
ternative plans. One of the most important factors that
aects plan cost is
selectivity
, which is the number of
tuples satisfying a given predicate. Therefore, in most
cases, the accuracy of selectivity estimates directly af-
fects the choice of best plan.
A study on error propagation [IC91] revealed that
selectivity estimation errors can increase exponentially
with the number of joins and thus aect the decisions
in query optimization. Accurate selectivity estimation
has become even more importantintoday's systems of
much larger database sizes, possibly distributed over
a LAN or a WAN. In such systems, the query plans
are expected to diverge much more in cost due to the
database size and the volume of data transmission.
This researchwas partially sponsored by the National Science
Foundation under grants IRI-9057573 and GDR-85-00108, by
NASA/USRA under contract 5555-09, by ARPA under contract
003195, and by the Universityof Maryland Institute for Advanced
Computer Studies (UMIACS).
Therefore, accurate selectivity estimation is even more
crucial.
The issue of selectivity estimation has attracted pop-
ular interest, and dierent methods have been pro-
posed [MO79, Chr83b, Chr83a, PSC84, KK85, HOT88,
Lyn88, MD88, LN90, SLRD93, Ioa93]. They can b e cat-
egorized into four classes: the
non-parametric method
,
the
parametric method
,
sampling
, and
curve tting
.In
the following paragraphs, we review the essential ap-
proaches for each of these four classes. A detailed survey
of the rst two classes can be found in [MCS88].
Non-Parametric Method
Methods in this class
maintain attribute value distributions using ad hoc
data structures and algorithms. The most common
method is the
histogram
, which divides an attribute
domain into intervals and counts the number of
tuples holding values which fall into eachofthe
intervals. Variations of the histogram method can
be found in [MO79, PSC84, MD88, Lyn88, Ioa93].
The histogram is simple, but tradeo between the
computation/storage overhead and the estimation
accuracy must be considered. Satisfactory accuracy
will not be reached until the domain is divided
into a sucient large number of small intervals.
In addition to the histogram, a pattern recognition
technique was used by [KK85] to construct discrete
cells of distribution table, and [Lyn88] used a
keyterm-oriented approachtokeep counts of the
most frequently queried attribute values.
Parametric Method
Parametric methods approxi-
mate the actual distribution with a mathematical
distribution function of a certain number of free sta-
tistical parameter(s) to be estimated (we call sucha
function a
model
function). Examples of the model
function include the uniform, normal, Pearson fam-
ily and Zipf distributions. In these metho ds, statis-
tics must be collected, either by scanning through
or by sampling from the relation, in order to esti-
mate the free parameter(s). These metho ds usually
1
pf3
pf4
pf5
pf8
pf9
pfa

Partial preview of the text

Download Adaptive Selectivity Estimation using Query Feedback: A Recursive Approach and more Papers Database Management Systems (DBMS) in PDF only on Docsity!

Adaptive Selectivity Estimation Using Query Feedback

Chungmin Melvin Chen

Department of Computer Science

University of Maryland

College Park, MD 20742

[email protected]

Nick Roussop oulos

Department of Computer Science

University of Maryland

College Park, MD 20742

[email protected]

Abstract

In this pap er, we prop ose a novel approach for estimating the record selectivities of database queries. The real attribute value distribution is adaptively approximated by a curve- tting function using a query feedback mechanism. This approach has the advantages of requiring no extra database access overhead for gathering statistics and of b eing able to continuously adapt the value distribution through queries and up dates. Exp erimental results show that the estimation accuracy of this approach is comparable to traditional metho ds based on statistics gathering.

1 Intro duction

In most database systems, the task of query optimiza- tion is to cho ose an ecient execution plan. Best plan selection requires accurate estimates of the costs of al- ternative plans. One of the most imp ortant factors that a ects plan cost is selectivity, which is the numb er of tuples satisfying a given predicate. Therefore, in most cases, the accuracy of selectivity estimates directly af- fects the choice of b est plan. A study on error propagation [IC91] revealed that selectivity estimation errors can increase exp onentially with the numb er of joins and thus a ect the decisions in query optimization. Accurate selectivity estimation has b ecome even more imp ortant in to day's systems of much larger database sizes, p ossibly distributed over a LAN or a WAN. In such systems, the query plans are exp ected to diverge much more in cost due to the database size and the volume of data transmission.  This research was partially sp onsored by the National Science Foundation under grants IRI-9057573 and GDR-85-00108, by NASA/USRA under contract 5555-09, by ARPA under contract 003195, and by the University of Maryland Institute for Advanced Computer Studies (UMIACS).

Therefore, accurate selectivity estimation is even more crucial. The issue of selectivity estimation has attracted p op- ular interest, and di erent metho ds have b een pro- p osed [MO79, Chr83b, Chr83a, PSC84, KK85, HOT88, Lyn88, MD88, LN90, SLRD93, Ioa93]. They can b e cat- egorized into four classes: the non-parametric method, the parametric method, sampling, and curve tting. In the following paragraphs, we review the essential ap- proaches for each of these four classes. A detailed survey of the rst two classes can b e found in [MCS88].

Non-Parametric Metho d Metho ds in this class maintain attribute value distributions using ad ho c data structures and algorithms. The most common metho d is the histogram, which divides an attribute domain into intervals and counts the numb er of tuples holding values which fall into each of the intervals. Variations of the histogram metho d can b e found in [MO79, PSC84, MD88, Lyn88, Ioa93]. The histogram is simple, but tradeo b etween the computation/storage overhead and the estimation accuracy must b e considered. Satisfactory accuracy will not b e reached until the domain is divided into a sucient large numb er of small intervals. In addition to the histogram, a pattern recognition technique was used by [KK85] to construct discrete cells of distribution table, and [Lyn88] used a keyterm-oriented approach to keep counts of the most frequently queried attribute values.

Parametric Metho d Parametric metho ds approxi- mate the actual distribution with a mathematical distribution function of a certain numb er of free sta- tistical parameter(s) to b e estimated (we call such a function a model function). Examples of the mo del function include the uniform, normal, Pearson fam- ily and Zipf distributions. In these metho ds, statis- tics must b e collected, either by scanning through or by sampling from the relation, in order to esti- mate the free parameter(s). These metho ds usually

require less storage overhead and provide more ac- curate estimation than non-parametric metho ds (if the mo del function ts the actual distribution). The disadvantage of this metho d is that the \shap e" of the actual distribution must b e known a priori in or- der to cho ose a suitable mo del function. Moreover, when the actual distribution is not shap ed like any of the known mo del functions, any attempt to approxi- mate the distribution by this metho d will b e in vain. Contributions to research of parametric metho ds can b e found in [S+^ 79, SB83, Fed84, Chr83b, Chr83a].

Curve Fitting In order to overcome the in exibility of the parametric metho d, [LST83] and [SLRD93] used a general p olynomial function and applied the criterion of least-square-error to approximate at- tribute value distribution. First, the relation is ex- haustively scanned, and the numb er of o ccurrences of each attribute value is counted. These numb ers are then used to compute the co ecients of the optimal p olynomial that minimizes the sum of the squares of the estimation errors over all distinct at- tribute values. Polynomial approximation has b een widely used in data analysis; however, care must b e taken here to avoid the problem of oscillation (which may lead to negative values) and rounding error^1 (which may propagate and result in p o or estimation when the degree of the p olynomial is high, say, more than 10).

Sampling The sampling metho d has recently b een investigated for estimating the resulting sizes of queries. Sample tuples are taken from the relations, and queries are p erformed against these samples to collect the statistics. Sucient samples must b e examined b efore desired accuracy can b e achieved. Variations of this metho d have b een prop osed in [HOT88, LN90, HS92]. Though the sampling metho d usually gives more accurate estimation than all other metho ds (supp ose su ucient samples are taken), it is primarily used in answering statistical queries (such as COUNT(: : :)). In the context of query optimization where selectivity estimation is much more frequent, the cost of the sampling metho d is prohibitive and has essentially prevented its practical use. Although accuracy is very imp ortant for selectivity estimates, the cost of obtaining such estimates must b e con ned if they are to b e cost e ective. In all the ab ove metho ds, however, extra I/O accesses to the

(^1) The problem caused by rounding errors is usually termed a case of b eing il l-conditioned. This can always b e avoided by representing the approximating p olynomial with a more numerical ly stable basis. For example, the Legendre p olynomials are used as the basis in [LST83].

database are required for the very purp ose of collecting statistics. This pro cedure might b e exp ensive and, as suggested, should b e done o -line or when the system is light-loaded. In a static database where up dates are rare, this overhead is acceptable. However, in the presence of up dates, the pro cedure must b e re-run either p erio dically or whenever the up dates exceed a given threshold. This pro cess not only incurs more overhead, but also degrades the query optimizer b efore the out- dated statistics are refreshed. In the following, we present a novel approach which approximates the attribute value distribution using query feedbacks and totally avoids the overhead of statistics collection. The idea is to use subsequent query feedbacks to \regress" the distribution gradually, in the hop e that as queries pro ceed, the approximation will b ecome more and more accurate. We say that the adap- tive approximation \learns" from the query executions in the sense that it not only \rememb ers" and \recalls" the selectivities of rep eating query predicates, but can also \infer" (predict) the selectivities of new query pred- icates. This approach is advantageous in the following resp ects:

 Eciency | Unlike the previous metho ds, no o - line database scans or on-line sampling are needed to form the value distribution. Also, unlike all the other metho ds (except sampling [Wil91]), where the statistics collection and computation overhead is prop ortional to the relation size, the overhead of our metho d has a negligible cost in constant time for each query feedback, regardless of the relation size.

 Adaptation | The technique we use here adapts the approximating value distribution to queries and up dates. None of the previous metho ds achieve this. They neither take into account query information when approximating the value distribution (only relations are scanned), nor continuously adjust the distribution to up dates (re-computation is invoked only after the up dates exceed a threshold).

The rest of this pap er is organized as follows: Section 2 describ es the adaptive selectivity estimator in detail. Section 3 presents some of our exp erimental results. Finally, conclusions are given in Section 4.

2 Adaptive Selectivity Estimation

In this section, we describ e the implementation of an Adaptive Selectivity Estimator (ASE). At the heart of our approach is a technique called recursive least- square-error (RLSE), which is adopted to adjust the approximating distribution according to subsequent feedbacks. Before exploring the details, we rst de ne some notations used throughout this pap er.

G = P ^1 ). The computation complexity is in the order of O (n^2 ). Since n is a pre-chosen small integer, the computation overhead p er query feedback is small and is considered constant, regardless of the relation size. The initial values G 0 and A 0 may a ect the convergence rate of A i and, thus, the rate at which fi converges to fA. We describ e later in this section how to initialize G 0 and A 0 with appropriate values. It is interesting to see that the computation of A i resembles the technique of stochastic approximation [AG67], in the sense that A i is adjusted from A i 1 by subtracting a correction term which is the pro duct of the estimation error (Xi A i 1 si ) and the gain value Gi X (^) it. Because of their simplicity and eciency in b oth space requirement and computation, Eqs. 8 and 9 were adopted in the ASE.

Accommo dating Up date Adaptiveness (with Weighted LSE)

The RLSE can b e further generalized to accommo date adaptability to up dates. We accomplish this by asso ciating di erent weights with the query feedbacks so that the outdated feedbacks can b e suppressed by assigning smaller weights to them. In Eq. 1, we now asso ciate an importance weight (^) i to the estimation error of the ith query, and a fading weight (^) i to the estimation errors of all the preceding queries. That is, instead of minimizing Eq. 1, we now want to minimize:

X^ m

i=

[(

Y^ m

j =i+

j )^ ^ i ^ (^ s^i ^ si )]^2 :^ (10)

The recursive solution to the ab ove is similar to Eqs. 8 and 9 (derivation details can b e found in [CR94]):

A i = A i 1 (^) i^2 Gi X (^) it (Xi A i 1 si ); (11) Gi = ( 1 i

)^2 Gi 1

( i i

)^2 (Gi 1 X (^) it )( (^2) i + (^) i^2 Xi Gi 1 X ti )^1 (Xi Gi 1 );(12)

for i = 1 ; 2 ; : : : Intuitively, (^) i s determine the \imp or- tance" of individual feedbacks; (^) i s determine the \for- getting" rate of previous feedbacks. Note that Eqs. 8 and 9 o er a sp ecial case of Eqs. 11 and 12 with i =^ i =^ 1,^ for^ all^ i.^ Apparently,^ di^ erent^ weights^ af- fect the adaptation b ehavior of the approximating func- tion. As an innovation, we consider only xed-value weights. We set (^) i = (^) i = 1 for all i, except that (^) i is assigned another p ositive numb er less than 1 if i is the rst feedback after up date. The smaller the (^) i , the more the knowledge from previous feedbacks is to b e forgotten. Note that we cannot set (^) i = 0, b ecause it app ears as a denominator in Eq. 12. Nonetheless, the same e ect (of discarding all previous knowledge) can b e achieved by assigning an extremely small numb er to

i.^ Exp^ eriments^ with^ di^ erent^ values^ of^ i are^ given^ in the next section.

Initializing A 0 and G 0 The initial values of G 0 and A 0 must b e determined b efore the recursive formulas in Eqs. 11 and 12 can b e used. Theoretically, arbitrary initial values can b e used for G 0 and A 0 [You84], though they di er greatly in convergence rates. To sp eed up convergence, we compute A 0 and G 0 (= P 0 1 ) using Eqs. 4 and 5 by substituting the following (n + 1) manual feedbacks into Eq. 3:

li = hi = dmin + i 1 n 1  ; si = jRj  ; for i = 1 : : : n (13) ln+1 = dmin ; hn+1 = dmax ; sn+1 = jRj; (14)

where  = dmax dmin , jRj denotes the numb er of tuples in relation R. The intention here is to force ASE to b egin with a uniform distribution (enforced by Eq. 13), and to keep knowledge of the relation cardinality in the gain matrix (enforced by Eq. 14).

Cho osing the Mo del Functions The remaining problem now is to cho ose the mo del func- tions i (x). The p olynomial function is a go o d candi- date due to its generality and simplicity and has b een used in [LST83] and [SLRD93]. We adopted p olynomi- als of degree 6 throughout our exp eriments, i.e., the ap- proximating function is of the form f (x) =

P 6

i=0 ai^ x i (^). Whereas p olynomials of higher degrees have the p on- tential problem of b eing ill-conditioned, p olynomials of lower degrees might not b e exible enough to t the variety of actual distributions. Therefore, our choice of degree 6 is a compromise b etween these concerns 3. Another interesting class of functions is the spline func- tions [dB78], which are piecewise p olynomial functions. Splines have many advantages over p olynomials in the asp ects of adaptability and numerical stability. How- ever, they are more complex in computation and partic- ularly in representation. We are currently investigating this approach and will not discuss it here. A practical problem of p olynomials is the negative values which are undesired in distribution approxima- tions. This p oses no problem so long as the negative values o ccur only outside the attribute domain, or so long as the resulting estimated selectivity of the query of interest is still p ositive (even if some negative values do o ccur within the domain). If a negative selectivity is ever estimated for a query, we simply use zero instead (and note that if the error is large, it will b e tuned (^3) In our exp eriments using degree 6, the \ill-conditioned" problem did not arise. However, for higher degrees we might need to use another basis (such as Legendre p olynomials or B-splines) since the basis of xi^ ; i = 1 ; : : : ; n is in general ill-conditioned for large values of n.

through feedback). Finally, we summarize ASE in the following description.

Variables A: the (adaptable) co ecients of a p olynomial f of degree 6; let F b e the inde nite integral of f ; G: the gain matrix; Initialization Use the manual feedbacks listed in Eqs. 13 and 14 to compute the initial values for A and G from Eqs. 3, 4 and 5. Selectivity Estimation The selectivity of query qi = (li ; hi ) is estimated as F (hi + 1) F (li ); if it is negative, simply return

Feedback and Adaptation After the execution of qi , get feedback i = (li ; hi ; si ) where si is the actual selectivity of qi obtained from execution. If qi is the rst query after the latest up date, set the fading weight (^) i to a p ositive numb er less than 1. Use i to adjust A and G, as shown in Eqs. 11 and 12.

Comparison with [SLRD93]

Sun, Ling, Rishe, and Deng prop osed in [SLRD93] a metho d of approximating the attribute distribution using a p olynomial with the criterion of least-square- error. While b oth their metho d and ours use p olynomial approximations, there are several di erences b etween the two metho ds. First, their approach is static in the sense it is necessary to scan the database and count the frequencies of distinct attribute values, and, once computed, the approximating distribution remains unchanged until the next re-computation. Our metho d is dynamic and dep ends only on query feedbacks, with no access to the database. For a relation which is large and/or is up dated regularly, the overhead of collecting or refreshing the statistics can b e very exp ensive. Our approach totally avoids such overhead. Besides, in an environment where queries exhibit highly temp oral or spatial lo cality on certain attribute ranges, ASE's dynamic adaptation to queries will p erhaps b e of greater b ene t. Finally, ASE's adaptiveness to up dates not only eliminates the overhead of statistics re-collection, but also provides a more graceful p erformance degradation for selectivity estimations through a query session interleaved with up dates.

2.2 An Example

We use an example to demonstrate how the ASE works by using successive query feedbacks to approximate the data distribution. The exp erimental data is from a

queries 1 2 3 4 [li ; hi ] [1935,1966] [1925,1950] [1904,1939] [1890,1923] s^i 1073 1138 1248 567 si 1872 1399 890 136 5 6 7 8 9 [1908,1913] [1948,1989] [1957,1980] [1964,1989] [1916,1981] 2 1956 1103 1041 3173 14 2033 1130 1134 3045

(^01900 1920 1940 1960 )

20

40

60

80

100 (1) begining

f

(^01900 1920 1940 1960 )

20

40

60

80

100 (2) after 2 query feedbacks

f

(^01900 1920 1940 1960 )

20

40

60

80

100 (3) after 3 query feedbacks

f

(^01900 1920 1940 1960 )

20

40

60

80

100 (4) after 9 query feedbacks

f

Figure 1: Adaptation Dynamics of ASE - an Example

movie database, courtesy of Dr. Wiederhold of Stanford University, which records 3424 movies pro duced during the years 1890{1989. Figure 1 snapshots the evolution of the approximating distribution for a sequence of query feedbacks. The queries are listed in the table, where [li ; hi ] denotes the selected range of the ith query, s^i denotes the selectivity estimated (by ASE) b efore the query execution, and si denotes the actual selectivity obtained after the query execution. In each frame, the curve of the approximating distribution fi , drawn in solid line, is compared to the real distribution, drawn in discrete p oints. In frame 1, uniform distribution is assumed at the very b eginning, as no queries have b een issued. Note that knowledge of the relation cardinality (3424 tuples) has b een implicitly enforced in the initial approximating distribution f 0 , using the initialization scheme explained in the previous section. After the execution of two queries, as shown in frame 2, the approximating curve b ecomes closer to the actual distribution. However, f 2 is relatively inaccurate for attribute ranges outside [1925; 1966] which have not b een queried yet (and, thus, no distribution information is yet known). The third query and its feedback  3 = (1904; 1939 ; 890 ) tunes f 2 into f 3 with b etter accuracy for range [1904; 1939]. It is worth mentioning

were run for b oth ASE and SLR. Table 3 lists the average error p er query of ASE and SLR under each data distribution. In order to achieve a fair comparison b etween ASE and SLR, the average errors, which exclude the rst 10 queries of each query stream (during which ASE is still in its \learning" stage), are also calculated for comparison. The rst table shows that ASE is slightly inferior to SLR in estimation accuracy; however, the second table shows that after ASE converges (after 10 queries), its accuracy is very comparable to that of SLR. Figures 2 through 5 depict the corresp onding dynamics of ASE and SLR for one of the query streams under each data set. In the gures to the left marked (a), curve g corresp onds to the approximating distribution computed from SLR; curve fi denotes the adaptive approximating distribution of ASE after i query feedbacks. Figures (b) compare the estimation errors of ASE and SLR by plotting them along with the query streams. The adaptiveness of ASE can b e clearly observed from the decreasing trend of errors as queries pro ceed. The o ccasionally high relative errors of ASE are either caused by stringently small selectivities (as evidenced by the high relative errors of SLR for the same queries), or are indications of the moments where feedbacks take place for the rst time on the queried ranges. However, as can b e seen from all the gures, after sucient query feedbacks have covered the whole attribute domain, ASE converges the approximating distribution to a stable curve and provides estimations with constantly small errors.

3.2 Adaptiveness of ASE to Query Lo cality

No matter what metho d is used to estimate the data distribution, the computation capacity of the metho d is always limited (e.g., the number of intervals in a histogram, the degree of a p olynomial). It is not uncommon for the distribution to b e approximated to b e to o detailed to b e mo deled by the limited capacity. Therefore, we b elieve that instead of approximating the overall distribution evenly, the limited capacity should b e used to approximate more accurately the lo cal distribution of a rather narrow attribute sub- range which imp oses either a temp oral or spatial query lo cality. ASE inherits this merit: the more query feedbacks obtained from a lo cal area, the more accurate the resulting approximating distribution for this area. An \event" database which contains 431,258 records of events during 1948-1978 was used in this exp eriment. Three levels of query lo calities, as outlined in Table 4, were designed to compare ASE and SLR. For each level of lo cality, three random query streams (each of which contains 50 queries) were tested for b oth ASE and SLR. Table 5 summarizes the average errors for the 10th to 50th queries (we excluded the rst 10 queries during

Queried Range Lo cality LowQL Jan. 1948 { Dec. 1978 Low MedQL Jan. 1948 { June 1960 Medial HighQL Jan. 1948 { Jan. 1953 High

Table 4: Three Levels of Query Lo calities

ASE SLR abs. err. rlt. err. abs. err. rlt. err LowQL 1.1 5.6 0.93 5. MedQL 0.33 6.3 0.66 10. HighQL 0.086 12.8 0.14 21.

Table 5: Average Errors in Di erent Query Lo calities

which ASE has not yet converged). The curves of the approximating functions and the estimation errors of ASE and SLR are graphed for comparison, according to the three levels of lo calities, in Figures 6 , 7, and 8. It can b e seen b oth from the tables and gures that ASE and SLR b ehave almost the same for low lo cality, but that as lo cality increases, ASE turns out to b e b etter. This is b ecause ASE is computed dynamically according to the query feedbacks and thus implicitly takes into account the query lo cality; in contrast, SLR is statically computed from the underlying data.

3.3 Adaptiveness to Up dates (ASE Performance under Up dates) In this section, we show the elegant adaptation of ASE to up dates. The normal distribution data from Sec- tion 3.1 is used again. Table 6 briefs the character- istics of three di erent up date workloads to b e inter- leaved with the query streams (more details ab out the up date workloads are given in the app endix). Orthog- onal to the up date loads are three versions of ASE, namely, ASE 0 : 01 , ASE 0 : 1 , and ASE 0 : 5 , with di erent fading weights (as indicated in the subscripts). For each up date workload, three random query streams (each of which contains 40 selection queries interleaved with up- dates) are generated, and each of them is tested with all three fading weights. Table 7 tabulates the average errors; Figures 9, 10, and 11 corresp ond to the adap- tation dynamics of ASE in the three di erent up date loads. The corresp onding curves for the three fading weights are group ed and graphed in each gure. It can b e seen from the gures that ASE adapts ele- gantly to all up date loads. For example, in Figure 9.b, the errors go up over a few queries after the 10th query where up date o ccurs, and then decline back to a sta- ble low level. This adaptation can also b e observed in Figure 9.a, where frames 2 through 4 show the adap- tation of the approximating curves to the lo cal distri- bution change at interval [ 50 ; 250]. It is interesting to note from Table 7 that ASE 0 : 01 , ASE 0 : 1 , and ASE 0 : 5 are resp ectively the b est in up date loads LOAD1, LOAD3,

up date o ccurrences no. of total tuples up dated change of distribution shap e up date transition LOAD1 at 11 4,500 lo cal, big increase in batch LOAD2 at 11, 17, 23, 29 9,000 global, slightly increase gradual LOAD3 at 11, 17, 23, 29 9,000 global, drastic gradual

Table 6: Characteristics of Three Up date Workloads

Up date ASE (^) =0: 01 ASE (^) =0: 1 ASE (^) =0: 5 Workload abs. err. rlt. err. abs. err. rlt. err. abs. err. rlt. err. LOAD1 3.38 16.7 3.58 25.7 4.71 30. LOAD2 3.35 22.2 2.66 17.2 2.59 15. LOAD3 5.58 31.0 4.19 21.3 4.24 21.

Table 7: Ave. Errors in Di erent Up date Workloads

and LOAD2. This is no surprise since in LOAD1, a vast amount of up date is done at once and thus it is advan- tageous to forget previous feedbacks and rely mainly on new ones. Therefore, the smallest fading weight ASE 0 : 01 (which forgets previous feedbacks to the greatest extent) outp erforms the other two in this case. Similarly, in LOAD2, the shap e of the distribution do es not change to o much during successive up dates, and thus ASE 0 : 5 b ene ts the most by using old knowledge during transi- tion. Finally, in LOAD3, where the distribution shap e changes greatly through gradual up dates, the use of ASE 0 : 1 o ers a compromise b etween the two extremes.

4 Conclusions

In this pap er, we have presented a new approach for se- lectivity estimation. Capitalizing on the technique of re- cursive weighted least-square-error, we devised an adap- tive selectivity estimator which uses query feedbacks to approximate the actual attribute distribution and to provide ecient and accurate estimations. The most signi cant advantage of this approach over traditional metho ds is that it incurs no extra cost for gathering database statistics. Furthermore, it adapts b etter to up dates and query lo calities.

We hop e this study will inspire a new direction for data knowledge acquisition, esp ecially in systems where statistics gathering is cost prohibitive b ecause of large data sizes (such as tertiary databases). The adaptive selectivity estimator can b e further improved in several ways and explored in several directions. First, we will re ne the feedback mechanism so that adaptation will stop after the approximating distribution converges and will b e triggered after up dates. We would also like to extend this work to complex queries which involve comp ound predicates or joins. Lastly, mathematical analysis of ASE is desired in order to give deep er insight into its p erformance b ehavior under diverse query distributions and into its theoretical limits.

Acknowledgements

The authors would like to thank Dr. Gio Wiederhold for providing us with a copy of the movie database. Sp ecial thanks go also to the anonymous referees for their valuable comments which have help ed us improve the quality and readability of this pap er.

References

[AG67] A.E. Alb ert and L.A. Gardner. Stochastic Approximation and Nonlinear Regression. M.I.T. Press, Cambridge, Massachusetts,

[Chr83a] S. Christo doulakis. Estimating blo ck trans- fers and join sizes. In Procs. of 1983 ACM SIGMOD Intl. Conf. on Management of Data, pages 40{54, New York, 1983.

[Chr83b] S. Christo doulakis. Estimating record selec- tivities. Inf. Syst., 8(2):105{115, 1983.

[CR94] C.M. Chen and N. Roussop oulos. Adaptive selectivity estimation using query feedback I: p olynomial approach. Technical Rep ort CS- TR-3197, Dept. of Comp. Sci., University of Maryland, College Park, 1994.

[dB78] C. de Bo or. A practical guide to splines. Springer-Verlag, New York, 1978.

[Fed84] J. Fedorowicz. Database evaluation using multiple regression techniques. In Procs. of the ACM SIGMOD Intl. Conf. on Manage- ment of Data, pages 70{76, Boston, MA,

[HOT88] W. Hou, G. Ozsoyoglu, and B. K. Taneja. Statistical estimators for relational alge- bra expressions. In Procs. of the ACM SIGACT-SIGMOD Symposium on Princi- ples of Database Systems, pages 276{287,

(^0) -100 0 100 200 300 400 500

5

10

15

20

25

30

35

attribute values

number of tuples

(a) approximating distribution curves

f f

f

f g

ASE: SLR:

f g

0 10 20 30 40 50 0

1

2

3

4

queries

rlt err to relation size(%)

(b) selectivity estimation errors ASE SLR

(^00 10 20 30 40 )

50

100

queries

rlt err to query size(%)

Figure 2: Normal Distribution

(^00 200 400 600 800 )

10

20

30

40

50

60

70

attribute values

number of tuples

(a) approximating distribution curves

f

f

f

g (^00 10 20 30 40 )

5

10

15

20

queries

absolute error(%)

(b) selectivity estimation errors

(^00 10 20 30 40 )

50

100

150

queries

relative error (%)

Figure 3: Chi-Square Distribution

0 100 200 300 400 500 600 700 800

0

10

20

30

40

50

60

70

80

attribute values

number of tuples

(a) approximating distribution curves

f

f

f

g 0 10 20 30 40 50

0

10

20

30

40

queries

absolute error (%)

(b) selectivity estimation errors

(^00 10 20 30 40 )

50

100

150

queries

relative error (%)

Figure 4: the F Distribution

(^0) -100 0 100 200 300 400 500

10

20

30

40

50

60

attribute values

number of tuples

(a) approximating distribution curves

f

f

f g (^00 10 20 30 40 )

5

10

15

20

queries

absolute error(%)

(b) selectivity estimation errors

(^00 10 20 30 40 )

50

100

150

200

queries

rlt. selectivity error(%)

Figure 5: a bi-mo dal Distribution

(^01950 1955 1960 1965 1970 )

1000

2000

3000

4000

5000

6000

7000

8000

9000

attribute values (month/year)

number of tuples

(a) approximating distribution curves

ASE: SLR:

f g

f g

(^010 15 20 25 30 35 40 45 )

1

2

3

4

queries

absolute error (%)

(b) selectivity estimation errors ASE SLR

(^010 15 20 25 30 35 40 45 )

10

20

30

queries

relative error (%)

Figure 6: Adaptation in LowQL (Low Query Lo cality)

19480 1950 1952 1954 1956 1958 1960

500

1000

1500

2000

2500

3000

attribute values (month/year)

number of tuples

(a) approximating distribution curves

f g

(^010 15 20 25 30 35 40 45 )

1

2

queries

absolute error (%)

(b) selectivity estimation errors

(^010 15 20 25 30 35 40 45 )

10

20

30

40

queries

relative error (%)

Figure 7: Adaptation in MedQL (Medial Query Lo cality)

19480 1949 1950 1951 1952 1953

100

200

300

400

500

600

700

800

900

1000

attribute values (month/year)

number of tuples

(a) approximating distribution curves

f

g 10 15 20 25 30 35 40 45 50

0

queries

absolute error (%)

(b) selectivity estimation errors

(^010 15 20 25 30 35 40 45 )

20

40

60

queries

relative error (%)

Figure 8: Adaptation in HighQL (High Query Lo cality)