Skip to main content
Scientific Reports logoLink to Scientific Reports
. 2023 Apr 11;13:5903. doi: 10.1038/s41598-023-31758-7

Multidimensional query processing algorithm by dimension transformation

Rejwana Tasnim Rimi 1,✉, K M Azharul Hasan 1, Tatsuo Tsuji 2
PMCID: PMC10090182  PMID: 37041199

Abstract

Multidimensional query processing is an important access pattern for multidimensional scientific data. We propose an in-memory multidimensional query processing algorithm for dense data using a higher-dimensional array. We developed a new array system namely a Converted two-dimensional Array (C2A) of a multidimensional array of dimension n (n>2) where the n dimensions are transformed into 2 dimensions. Using the C2A, we design and analyze less complex algorithms that show improve performance for data locality and cache miss rate. Therefore, improved performance for data retrieval is achieved. We demonstrate algorithms for single key and range key queries for both Traditional Multidimensional Array(TMA) and C2A. We also compare the performance of both schemes. The cost of index computation gets high when the number of dimensions increases in a TMA but the proposed C2A based algorithm shows less computation cost. The cache miss rate is also lower for in C2A based algorithm than TMA based algorithm. Theoretical and experimental results show that the performance of C2A based algorithm outperforms the TMA-based algorithms.

Subject terms: Computational science, Computer science, Information technology, Scientific data

Introduction

In many scientific and industrial applications, massive volumes of data have been generated, causing management and processing bottlenecks1. The majority of these data are multidimensional which are stored and analyzed using a multidimensional array for example SciDB2, SparkArray3, SanssouciDB4, and SharkDB5. Therefore, the efficient design of retrieval algorithms from multidimensional arrays to handle the high dimensional data is a cramming need for data scientists6. Traditional Multidimensional Array (TMA) facilitates quick random access to data via the addressing function, but as the number of dimensions grows, the performance of the multi-dimensional array retrieval declines. When the number of dimensions of a multidimensional array increases the cache miss rate and index computation cost automatically increase.The cache miss rate increases for higher-dimensional arrays as more cache lines need to be accessed7,8. Therefore, to provide fast retrieval, well organization of higher dimensional data is necessary so that the target data are colocated. In this paper, we construct and analyze a proficient retrieval strategy using dimension transformation. We convert an n dimensional TMA into a two-dimensional array namely a Converted two-dimensional Array (C2A). The C2A represents an n dimensional (n>2) array by a 2-dimensional array where each odd dimension of the TMA contribute for row and each even dimensions contribute for column dimension. With the dimension transformation, the target data are colocated which helps to design less complicated algorithms for efficient retrieval. The superiority of transformation is well studied in the loop transformation technique for compiler optimization9 and higher dimensional matrix operations10. The array cells are rearranged by changing the loop nests to make them closer to the cache memory in the loop transformation. This transformation is useful for array operations to increase the cache hit rate. In our approach, when we convert the n dimensional TMA to a 2 dimensional C2A, the n loops are transformed into two loops namely outer and inner loops. As a result, enhanced data locality is possible since the inner loops randomly access the cache, which increases cache misses. We apply the C2A scheme to design new retrieval algorithms for array-based multidimensional data. Therefore, improved retrieval performance is found with the proposed C2A-based algorithms. Our theoretical and experimental analysis shows that with the growth of a number of dimensions, the C2A-based algorithms outperform the TMA-based algorithms. The multidimensional query is well defined for datacube computation as MOLAP operations11. Therefore it can easily be applied to datacube computation12,13. The scheme can also be applied to multidimensional databases, Top-k queries1,14, and multiway data analysis15. The rest of the paper is organized is as follows: firstly explain the idea of dimension transformation, then retrieval algorithm for multidimensional query processing, reveals the theoretical analysis of the algorithms, and then show the experimental results, some comparisons with other works are presented in related works and finally, outlines the conclusion.

Dimension transformation

Let A[S1][S2]…[Sn] be a TMA(n) where <x1,x2,…,xn> be the index of an element of A and S1,S2,…,Sn are the size of each dimension d1,d2,…,dn and xi=0,1,2,3,…,Si-1 where 1≤i≤n . Any element of TMA(n) <x1,x2,…,xn> can be accessed by the addressing function f(x1,x2,…,xn)=x1S2S3…Sn+x2S3S4…Sn+⋯+xn-1Sn+xn. We develop a two-dimensional array C2A A′[X′][Y′] of size S1′,S2′ and subscripts <X′,Y′> where X′(0≤X′<S1′) and Y(0≤Y′≤S2′). The X′ and Y′ are converted as follows :

X′=x1S3S5…ln-3Sn-1+x3S5…Sn-3Sn-1+⋯+xn-3Sn-1+xn-1,whenniseven.x1S3S5…ln-2Sn+x3S5S7…Sn-2Sn+⋯+xn-2Sn+xn,whennisodd.Y′=x2S4S6…ln-3Sn-1+x4S6…ln-3Sn-1+⋯+xn-3Sn-1+xn-1,whenniseven.x2S4S6…Sn-2Sn+x4S6S8…Sn-2Sn+⋯+xn-2Sn+xn,whennisodd.

From the above equation,the four-dimensional array is converted as X′=x1S3+x3 and Y′=x2S4+x4. Similarly, the six dimensional array is converted to C2A as X′=x1S3S5+x3S5+x5 and Y′=x2S4S6+x4S6+x6. Therefore, any element of C2A <X′,Y′> can be found by the addressing function:

f(X′,Y′)=X′S2′+Y′orf(X′,Y′)=Y′S1′+X′

where

S1′=S1×S3×S5×⋯×Sn-1,whenniseven.S1×S3×S5×⋯×Snwhennisodd.textsection2′=S2×S4×S6×⋯×Sn,whenniseven.S2×S4×S6×⋯×Sn-1,whennisodd.

Figure 1a shows a converted TMA of size3 to C2A of size27. We describe the C2A with odd dimensions as row and even dimensions as column. This row and column can be selected from any combinations from the n dimensions. The arbitrary combination does not have much effect for retrieval of array data15.

Figure 1.

Figure 1

Single key realization of C2A for X′.

Multidimensional query processing algorithm

We design multidimensional query processing algorithms for single key and range key query. Answering a query q consists of selecting the set of points from R that satisfy the query predicate of the form xi=v for single key query and for xi=v1∼v2 or xi>v1 or xi<v1 for range key query where R is the dataset of dimension n. Each point of R is specified by n co-ordinates each of which is a member of a specific domain di (1≤i≤n). By the dimension transformation technique (Sect. 2) the n dimensional point x is converted to 2 dimensional points x′ and the query is performed in the converted 2 dimensional space. Throughout the paper, we define a single key query of xi by form <∗,∗,…v,…∗,∗>(0≤v≤li-1) and <∗,∗,…v1∼v2,…∗,∗> for range key query, where v1 and v2 (v1>v2) is the value of the index xi and di is termed as known dimension and rq=∣v1-v2∣+1.

Single key query

Let A[S1][S2][S3][S4] be a TMA (4) of size [S1,S2,S3,S4]. The location of the tuple A[x1][x2][x3][x4] can be identified by index computation function f(x1,x2,x3,x4). The retrieval from TMA is straightforward. Algorithm 1 shows the pseudo code of single key query for the tuple <v,∗,∗,∗…> for TMA(n) where x1=v. We need (n-1) loops to carry out the search. In the next subsections we derive the algorithm to retrieve from C2A. Figure 1 shows the candidate array cells for a single key query.graphic file with name 41598_2023_31758_Figa_HTML.jpg

C2A algorithm development

Since C2A is a two-dimensional structure, it will take two loops only to retrieve any element. Following parameters are important to retrieve an element from C2A. The algorithm is designed to calculate these parameters.

  • value Start Index (SI) for x′ ( or y′)

  • total number of Target Rows (TR) (or Target Columns) for retrieval operation.

  • striding values to continue the loops.

We need three types of indices for TMA namely inner index, outer index and intermediate index for C2A algorithm development. Figure 1 shows the three types indices for <x1,x3,x5> where x1 is the outer index, x3 is intermediate index and x5 is the inner index. The intermediate index for a TMA(n) (n≤4) is void. We will present algorithms for C2A for four-dimensional (4D) array and then extend it to n dimensional arrays.

4D: For a query of the form xi=v where i is odd and (1≤i≤4) . For example, to retrieve the tuple <2,∗,∗,∗> which is the outer index as shown in Fig. 2a. The candidate rows for the query are X′=<8,9,10,11>. Hence SI=8 and TR=4. This candidate rows can be found in unit striding (i.e. striding value is 1). If xi of dimension i is known, then the SI=xi×S3=8 and TR=∏p=1,3Sp(p≠i). In case of tuple <∗,∗,2,∗> (see Fig. 2b) where x3 is known. The SI for C2A will be 2 (i.e x3) because x3 is an inner index. The stride value is S3. Therefore, candidate row indexes will be X′=<2,6,10,14>.

Figure 2.

Figure 2

Single key realization of C2A for X′.

Again for a query of the form xi=v where i is even and (1≤i≤4), the algorithm returns column index. For the tuple <∗,2,∗,∗>. The SI for C2A is be x2×S4=2×4=8 and the stride value is 1. The candidate column indices for the query are Y′=<8,9,10,11>. And for the tuple <∗,∗,∗,2> is the fourth index, the inner index, of TMA. The stride value for the loop is S4. Therefore, the candidate indices are Y′=<2,6,10,14>. Algorithm 2 summarizes the query processing for the converted row index X′.graphic file with name 41598_2023_31758_Figb_HTML.jpg

6D: Let A[S1][S2][S3][S4][S5][S6] be a TMA(6) of size [S1S2S3S4S5S6]. After transforming A to A′, the subscript of a tuple <x1,x3,x5> contributes for X′ and <x2,x4,x6> contributes for Y′. For example, for the query <∗,∗,1,∗,∗,∗> x3 is known. Because the known index is intermediate index, the SI for C2A will be x3×S5 and to retrieve the this index it needs 2 types of stride values namely unit stride and long stride. There are some consecutive target rows that are in unit stride and there also a period between the consecutive target rows which is called long strides (Fig. 1). For example, the target rows are X′=<3-5,12-14,21-23> for the query of the tuples <∗,∗,1,∗,∗,∗> as shown in Fig. 1. The consecutive (x3×S5) indices can be found by unit striding. The long stride between two consecutive unit stride is determined by pi=S5×(S3-1). The long stride is determined by the computation procedure of X′ as described in Sect. 2.

The summary of the query processing is shown in Algorithm 3 for X′.

nD: Let A[S1][S2]…[Sn] be a TMA(n) of size [S1S2…Sn] and xi of dimension i(1≤i≤n) is known. The values for SI of C2A for the known dimension i can be determined as SI=xi for inner index, SI=xi×S3×S5×⋯×Sn-1 for outer index, SI=xi×S5×S7×⋯×Si for intermediate index. The stride values for outer and inner index can be determined as stride=Sn-1 for inner index, stride=1 for outer index, The stride values depend on the known dimension. There are (n/2-2) intermediate indices possible (See X′ computation).graphic file with name 41598_2023_31758_Figc_HTML.jpg

Range key query

Let the range value of a range key query is nrq=v2-v1,(v2>v1). Therefore, the total target rows will be TRQ=nrq×∏p=1,3,5Sp(p≠i) for a C2A. Suppose we want to consider a query of <0-1,∗,∗,∗> for TMA(4). The target rows for the query are X′=<0-7>. The SI=v1×S3,TRQ=rq×S3 and rq=(v2-v1)+1 (SI=0 and TRQ=8). And unit striding is possible. If di is the known for 4D case, the SI=v1×S3=4 and TRQ=nrq×∏p=1,3Sp(p≠i). For example, for the query of the tuple <∗,∗,0-1,∗>, the SI for C2A will be 1 (i.e x3) because x3 is an inner index. The stride value is S3-nrq. Therefore, the row indices will be X′=<0-1,4-5,8-9,12-13>.

Again, for the query of the tuple <∗,0-1,∗,∗>, the SI and will be calculated as v1×S4=0×4=0 and stride value is 1. The candidate column indices are Y′=<0-7>(see Fig. 3a). For the tuple <∗,∗,∗,0-1> the stride value is (S4-nrq). Therefore, the target column indices are Y′=<0-1,4-5,8-9,12-13> (Fig. 3b).

Figure 3.

Figure 3

Range key query realization by C2A for Y′.

The candidate range of rows for the query <∗,∗,0-1,∗,∗,∗> is shown in Fig. 4. For the query <∗,∗,0-1,∗,∗,∗> x3 is known and the SI for C2A will be calculated as v1×S5. The query has both unit stride and long stride as the known index is an intermediate index. In Fig. 4a for the query <∗,∗,0-1,∗,∗,∗> where the target rows are <0-5,9-14,18-23>. There are 3 consecutive target rows (TRQ=S5×nrq) that can be found by unit striding. The long stride between two consecutive rows is determined by pi=S5×(S3-nrq).

Figure 4.

Figure 4

Range key query realization by C2A.

For a nD TMA A[S1][S2]…[Sn] of size [S1S2…Sn], the values for SI and the parameters are calculted as inner index, SI=v1, for outer index and intermediate index SI=v1×Sn-1×ln-3×⋯×li+2. The stride is Sn-1-nrq for inner index and 1 for outer index again for intermediate index, long stride is ld=Sn-1×⋯×S7×S5×(S3-nrq) and unitt stride. The algorithm for C2A of TMA(n) is summarized in Algorithm 4 for row indices X′.graphic file with name 41598_2023_31758_Figd_HTML.jpg

Theoretical analysis

Three aspects are considered for theoritical analysis namely cost for index computation, cost for cache line access and computational complexity. We assume the length of dimension is equal for each TMA dimensions (Si=S for 1≤i≤n). The total number of addition and multiplication operations contributes to index computation. Let α be the cost of multiplication, β be the cost of addition operation and η be the improvement of C2A based algorithm over TMA based algorithm. We developed the theoretical analysis for a single key query in this section. The theoretical analysis for a range key query is a straightforward extension of a single key query because when nrq=1 it becomes a single key query.

Cost for index computation

For a single key query, the number of elements to be accessed is Sn-1 both for TMA and C2A. The number of elements to be accessed is nrq×Sn-1 for the range key query. These elements are accessed only once.

4D: The index computation function of TMA and C2A are f and f′ f(x1,x2,x3,x4)=S×S×S×x1+S×S×x2+S×x3+x4 and f′(X′,Y′)=X′×S1′+Y′ where X′=x1×S3+x3, Y′=x2×S4+x4 and S1′=S1×S3. Therefore, f require 6 multiplication ( 6α) and 3 addition (3β) operations. Hence the cost for f is (6α+3β)S3. On the other hand, f′ require 1 multiplication and 1 addition opertations resulting the cost for f′ is (α+β)S3. The transformation cost for X′ is α+β and Y′ is α+β. And S1′ is α. All the transformations do not require any element to access. And these transformations are done only once. Therefore, total cost for C2A is (α+β)S3+3α+2β. Hence, η=(1-(α+β)S3+3α+2β(6α+3β)S3)×100%. We can simplify the equation by considering (α>>β) as Multiplication latency (IMUL) is 3 to 15 times longer than addition latency (ADD). We can also ignore the β with respect to α, then η=(56-36S3)×100%.

6D: There are 15 multiplication operations and 5 addition operations required for f, hence, the cost for f is (15α+5β)S5. And f′ requires 1 addition and 1 multiplication and cost is (α+β)S5 . The transformation cost for X′ is 3α+2β and Y′ is 3α+2β. And transformation cost for S1′ is 2α. Therefore, total cost for C2A is (α+β)S5+8α+4β. Therefore, η=(1-(α+β)S5+8α+4β(15α+5β)S5)×100%, and η=(1415-815S5)×100% for α>>β.

nD: For nD TMA, f need (n-1) addition and (n(n-1))2 multiplication operations. Therefore, costs are (n-1)β and (n(n-1))2α respectively. So total cost for TMA is ((n(n-1))2α+(n-1)β)Sn-1. The transformation cost for is n(n-2)4α, ((n/2)-1)β. Therefore,

η=(1-(α+β)S(n-1)+n(n-2)4α+2×(n2-1)β(n(n-1)2α+(n-1)β)Sn-1)×100%

For α>>β, η=(1-2n(n-1)-(n-2)2(n-1)Sn-1)×100%. Therefore, we conclude that, for large values of n and S, the η will increase. Hence, the proposed retrieval algorithm will get the facility for large arrays for index computation.

Cost for cache line access

The cache line is the unit of data transfer between the main memory and the cache. A whole line is read or written during data transfer by the system. The number of cache lines accessed can be determined by the algorithm namely LoopCost(S) proposed by Carr et al.7,8. The LoopCost(S) finds the number of cache lines accessed by a loop by computing the costs of various loop orders. We use the LoopCost(S) to analyze the cache line access of our algorithm. The value of LoopCost(S) indicates the cache miss rate for a loop. Hence smaller the value of LoopCost(S) indicates a smaller cache miss and higher cache hit. Let the cache line size be r (generally this size is 64 bytes). For 4D, we assume the loop order <S1,S2,S3,S4> to maintain the sequential access of the memory. The cache line accessed by TMA is determined by S3⌈S/r⌉. Since there are three inner loops of length S in Algorithm 1. On the otherhand, the cache line accessed by C2A is determined by S2⌈(S2/r)⌉. Since there is only one inner loop of length S2 in Algorithm 2. Therefore,

η=1-C2ATMA=1-S2⌈S2r)⌉S3⌈Sr⌉=1-⌈(S2r)⌉S⌈Sr⌉.

If Smodr=0 then η=0, otherwise η>0. For nD, we assume <S1,S2,…,Sn> loop order to mainatain the sequential access. The number of cache line accessed by C2A is S⌈n2⌉⌈S⌈n2⌉r⌉ and the number of cache line accessed by TMA is Sn-1⌈Sr⌉. Therefore,

η=1-S⌈n2⌉⌈S⌈n2⌉r⌉Sn-1⌈Sr⌉

Finally, we conclude that, if S is divisible by r then η=0, i.e. the number of cache lines accessed for both schemes are the same. When S is not divisible by r,  then η>0.

In the case of sequential access of sparse data in memory, TMA requires more time because data are stored in a more scattered way than C2A . We know, the linear equation for TMA and C2A is, f and f′

f(x1,x2,x3,x4)=s1×s2×s3×x4+s1×s2×x3+s1×x2+x1
f′(X′,Y′)=X′×S2′+Y′

where X′=x1×s3+x3, Y′=x2×s4+x4 and S2′=s1×s3. Let,s1=s2=s3=s4=2. For TMA, x1=1

Then, f=8×x4+4×x3+2×x2+1 ,so, f={1,3,5,7,9,11,13,15} and stride is s=2.

When x2=1 Then, f=8×x4+4×x3+2+x1 ,so, f={2-3,6-7,10,11-14-15} and stride is s×(s-1)=3.

When x3=1 Then, f=8×x4+4+2×x2+x1 ,so, f={4-7,12-15} and stride is s×s×(s-1)=5.

When x4=1, Then, f=8+4×x3+2×x2+x1 ,so, f={8-15}. For C2A, f′=4×x2′+x1′

When, x1=1,x1′=x1×s3+x3,x1′={2,3} (Because the value of x3 is 0 and 1)

Therefore, f′={2-3,6-7,10-11,14-15} and stride is s×s-1=3.

When, x3=1,so,x1′={1,2} f′={1-2,5-6,9-10,13-14} and stride is s×s-1=3.

When, x2=1,x2′=x2×s4+x4,x2′={2,3} f′={8-15}

When, x4=1,so,x2′={1,2} then, f′={4-7,8-11}

So, for 4D stride of TMA will be s×s×(s-1) and for n-D it will be sn-2×(s-1). And for C2A the hightest striding value for n-D will be sn/2-1×(s-1) which is less than TMA. The compiler maintains the row-wise data layout in the system. That’s why row-wise retrieval has quite improved performance than column-wise retrieval.

Computational complexity

For 4D, the computational complexity of single key query for C2A based algorithm (algorithm 2) is O(S×S2)=O(S3) since the TR iterates for S times because the striding values are different. For 6D, the computational complexity of C2A based algorithm (algorithm 3)is O(S2×S3)=O(S5). Therefore, the computational complexity of C2A based algorithm for nD is O(Sn-1). For range key query, nrq×si target rows are executed from the known dimension i. Hence the complexity for for range key query for C2A based algorithm is determined by O(nrq×Sn-1).

Experimental results

In this section, we compare the retrieval time of TMA-based algorithms versus the retrieval time of C2A based algorithms for single key query and range key query. The original data was in TMA and transformed to a C2A. We ignore the conversion cost from TMA to C2A. If the compiler provides the converted array C2A, the conversion cost can be ignored. Using the programming language C++, we take the execution time in milliseconds. We assume the array is dense.

Figure 5 shows the performance comparison for TMA versus C2A for a single key query for varying lengths of dimension for 4D, 6D, and 8D. All the possible single key queries are performed and the average of the results are shown in Fig. 5. The execution time of C2A based algorithms has a clear improvement over TMA-based algorithms for all the cases in Fig. 5a,b,c. This is because when the size of dimension S increases, the improvement η also increases. For large values of S and n, better performance for C2A based algorithms is found as discussed in Sect. 4. The C2A based algorithms get the advantages of less computational cost for index computation than TMA-based algorithms. Since TMA-based algorithms have many loops where C2A has only two loops. This number of loops gets increased when the number of dimension increase in TMA whereas the number of loops in C2A is fixed irrespective of the value of n. for example, the C2A based algorithms have 2 loops whereas the TMA based algorithms have n-1 loops for single key query and n loops for range key query. The cache miss is reduced because the C2A based algorithms have only an outer loop. But the cache miss has increased in TMA-based algorithms as it has n-2 (or n-1 range key query ) outer loops. this is because of the influence of the outer loop for random access of memory where as the influence of the inner loop to access the memory sequentially. Therefore, the cache miss rate for C2A based algorithms is lower than the TMA-based algorithms. Reducing the cache miss is desirable for the programmers and researchers as it improves the retrieval of data.

Figure 5.

Figure 5

Performance of TMA and C2A for single key query for varying length of dimension for 4D, 6D and 8D.

Figure 6a shows the performance for single key query of C2A and TMA based algorithms for varying number of dimension and Fig. 6b shows the average improvement of C2A based algorithm over TMA based algorithm for single key query. The improvement is nearly linear with incresing number of dimension. Figure 7 shows the retreival performance when the known or query dimension is on row wise (Fig. 7a) and column wise (Fig. 7b) for C2A based algorithm. The query was set such that only a row (or column) for C2A is selected. The comparison witth row wise and column wise query is shown in Fig. 7c. The row wise retrieval has improved performance than of column wise retrieval. This because the compiler maintains the row wise data layout in the system. Therefore, when the retrieval is performed by fixing rows for varying columns, it increases the cache hit rate of the processor because of the data locality. Figure 8a shows the range key query performance for varying number of dimension and Fig. 8b the improvement of C2A based algorithm over TMA based algorithms. The C2A based algorithms has improved performance than TMA based algorithms. Therefore, we conclude that the C2A based algorithms has improved performance than the TMA based algorithms for retrieval operations on higher dimensional arrays. Table  1 shows time comparison of single key and range key query for C2A based algorithms.

Figure 6.

Figure 6

Performance analysis of 4–10 dimensions for Single key query (TMA and C2A).

Figure 7.

Figure 7

Performance of row and column wise retrieval of Single key query for TMA and C2A with varying n.

Figure 8.

Figure 8

Performance analysis of 4–10 dimensions for range key query (TMA and C2A).

Table 1.

Time comparison of single key and range key query for C2A based algorithms.

Dimensions Single key query Range key query
TMA C2A Improvement (%) TMA C2A Improvement (%)
4D 4.014706 3.597059 10.40293 15.72917 14.69228 6.592116
6D 13.92105 11.28947 18.90359 45.57778 38.9 14.65139
8D 25.01389 17.65278 29.42809 66.625 46.75 29.83114
10D 52.33333 28.16667 46.17834 109.48 65.68 40.00731

Related works

Multidimensional data have been well studied in the form of the multidimensional arrays such as ArrayStore16, SciDB2, TileDB6, ChronosDB17 etc. Many parallel processing workloads for arrays are supported by ArrayStore16. An array storage manager is provided by TileDB6 manages the dense and sparse with embeddable libraries. A distributed array database is provided by ChronosDB17. All the array models use the TMA as their basic data structure and hence the retrieval is based on the TMA algorithms. To improve array computation18, introduced the EKMR scheme, which consists of a set of two-dimensional arrays that represent a high-dimensional array. They used the K-map technique to transform a four-dimensional array to a two-dimensional array. A hierarchical structure including an array of pointers is the n (n>4) dimensional generalization of EKMR. For large values of n (n>4) there are n-4 pointers arrays required19. Proposes GPU-based automatic data layout alterations for structured grid codes with dynamically generated arrays9. Proposes a loop transformation-based strategy for improving data locality in multidimensional arrays. They showed how transformation can help with array operations. In order to facilitate access to the elements, chunking, reordering, redundancy, and segmentation of large arrays are proposed in12.To improve speed20 suggest chunk-by-chunk caching. Chunking of arrays is the technique of breaking huge multidimensional arrays into smaller chunks for storage and processing. Each chunk is a n-dimensional array with a shorter length than the original array. Ref.16 demonstrates a chunking strategy for storing and analyzing multidimensional arrays, with the chunks remaining n-dimensional. The multidimensional query is well defined for datacube computation as MOLAP operations11. A good data structure is required for efficient datacube construction, which has been identified as one of the most critical and essential issues for MOLAP21,22. A data structure for growing data is proposed in21 and show the superiority of the structure over TMA data. The virtual denormalization for the main memory OLAP is presented in22 and shows some superiority of the scheme using TMA. Multidimensional data points are mapped to one-dimensional data points in23 for query operations. A new query problem namely k-truss most favorites querying problem is defined in24 to retrieve the most favourite object with users’ preferences based on the top-t favorites query. To reduce the query computation space and improve the query efficiency they also develop an optimized reverse query algorithm. To speed up query processing time and improve query accuracy of Bloom filter (BF) a novel sequence-based Bloom filter(BhBF) is proposed in25 which also support four important operations like insertion, query, deletion, and update. A probabilistic reverse top-k queries for monochromatic and bichromatic cases over uncertain databases are proposed in26 with effective pruning heuristics to reduce the search space. A comprehensive survey on personalized graph queries to compute personalized query results for users on the basis of their personalized preferences is presented in27. A scheme is developed to answer multidimensional range queries on multidimensional data using bucketization in28. The bucketization is treated as an optimization problem to reduce the risk of disclosure keeping the computational overhead below a certain overhead. In this paper, we convert the n dimensional data points to 2-dimensional points. The array models described in this section use TMA as their basic data structure, but the proposed C2A based algorithm shows better retrieval performance than the TMA.

Conclusion

We propose and evaluate an effective algorithm for query processing. Our algorithm is based on a converted multidimensional array. We calculate the execution time for single key and range key queries for TMA and C2A. The performance of our proposed C2A based algorithm outperforms the TMA-based algorithms. The reason for the better performance is that C2A requires two loops only that increases cache hits. The approach may easily be applied in a parallel and distributed environment for parallel processing, which is an essential future path of the work. The MapReduce algorithm can be developed for the efficient processing of multidimensional array data. The scheme can also be connected to compress database applications for scanty information. We believe the proposed retrieval algorithm using converted array can be efficiently applied to higher dimensional array data processing for actual applications.

Author contributions

All authors contributed to the research article. Data analysis, algorithm design, and implementation were performed by R.T.R., K.M.A.H., and T.T. The idea of the research and theoretical analysis was written by K.M.A.H. The coding, data analysis, and experimental results was written by R.T.R.

Data availability

The datasets that are used in this experiment are of the following two sources. The 4D data set is a 4-order tensor with numeric data values. The experiment on 4D data is done with different data sets from the Formidable Repository of Open Sparse Tensors and Tools (FROSTT)29. FROSTT is a collection of publicly available sparse tensor datasets and tools. It can be found at http://frostt.io/tensors. The 6D, 8D and 10D data sets that we used in this experiment are generated automatically using the rand() function of gcc compiler. The datasets can be available from the corresponding author on reasonable request.

Competing interests

The authors declare no competing interests.

Footnotes

Publisher's note

Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

References

  • 1.Amagata, D., Hara, T. & Nishio, S. Distributed top-k query processing on multi-dimensional data with keywords. In Proceedings of the 27th International Conference on Scientific and Statistical Database Management, 1–12 (2015).
  • 2.Brown, P. G. Overview of scidb: Large scale array storage, processing and analysis. In Proceedings of the 2010 ACM SIGMOD International Conference on Management of data, 963–968 (2010).
  • 3.Wang, W. et al. Sparkarray: An array-based scientific data management system built on apache spark. In 2016 IEEE International Conference on Networking, Architecture and Storage (NAS), 1–10 (IEEE, 2016).
  • 4.Plattner, H. Sanssoucidb: An in-memory database for processing enterprise workloads (Datenbanksysteme für Business, Technologie und Web (BTW), 2011).
  • 5.Wang, H., Zheng, K., Zhou, X. & Sadiq, S. Sharkdb: An in-memory storage system for massive trajectory data. In Proceedings of the 2015 ACM SIGMOD International Conference on Management of Data, 1099–1104 (2015).
  • 6.Papadopoulos S, Datta K, Madden S, Mattson T. The tiledb array data storage manager. Proc. VLDB Endow. 2016;10:349–360. doi: 10.14778/3025111.3025117. [DOI] [Google Scholar]
  • 7.Carr S, McKinley KS, Tseng C-W. Compiler optimizations for improving data locality. ACM SIGPLAN Not. 1994;29:252–262. doi: 10.1145/195470.195557. [DOI] [Google Scholar]
  • 8.McKinley KS, Carr S, Tseng C-W. Improving data locality with loop transformations. ACM Trans. Program. Lang. Syst. (TOPLAS) 1996;18:424–453. doi: 10.1145/233561.233564. [DOI] [Google Scholar]
  • 9.Cong, J., Zhang, P. & Zou, Y. Optimizing memory hierarchy allocation with loop transformations for high-level synthesis. In Proceedings of the 49th Annual Design Automation Conference, 1233–1238 (2012).
  • 10.Hasan KA, Shaikh MAH. Efficient representation of higher-dimensional arrays by dimension transformations. J. Supercomput. 2017;73:2801–2822. doi: 10.1007/s11227-016-1954-x. [DOI] [Google Scholar]
  • 11.Zhao, Y., Deshpande, P. M. & Naughton, J. F. An array-based algorithm for simultaneous multidimensional aggregates. In Proceedings of the 1997 ACM SIGMOD International Conference on Management of Data, 159–170 (1997).
  • 12.Zhang Y, Ordonez C, García-García J, Bellatreche L, Carrillo H. The percentage cube. Inf. Syst. 2019;79:20–31. doi: 10.1016/j.is.2018.01.005. [DOI] [Google Scholar]
  • 13.Merticariu, V. & Baumann, P. Massively distributed datacube processing. In IGARSS 2019-2019 IEEE International Geoscience and Remote Sensing Symposium, 4787–4790 (IEEE, 2019).
  • 14.Choi D, Park C-S, Chung YD. Progressive top-k subarray query processing in array databases. Proc. VLDB Endow. 2019;12:989–1001. doi: 10.14778/3329772.3329776. [DOI] [Google Scholar]
  • 15.Kolda TG, Bader BW. Tensor decompositions and applications. SIAM Rev. 2009;51:455–500. doi: 10.1137/07070111X. [DOI] [Google Scholar]
  • 16.Soroush, E., Balazinska, M. & Wang, D. Arraystore: A storage manager for complex parallel array processing. In Proceedings of the 2011 ACM SIGMOD International Conference on Management of data, 253–264 (2011).
  • 17.Zalipynis RAR. Chronosdb: Distributed, file based, geospatial array dbms. Proc. VLDB Endow. 2018;11:1247–1261. doi: 10.14778/3231751.3231754. [DOI] [Google Scholar]
  • 18.Lin C-Y, Liu J-S, Chung Y-C. Efficient representation scheme for multidimensional array operations. IEEE Trans. Comput. 2002;51:327–345. doi: 10.1109/12.990130. [DOI] [Google Scholar]
  • 19.Sung, I.-J., Liu, G. D. & Hwu, W.-M. W. Dl: A data layout transformation system for heterogeneous computing. In 2012 Innovative Parallel Computing (InPar), 1–11 (IEEE, 2012).
  • 20.Deshpande, P. M., Ramasamy, K., Shukla, A. & Naughton, J. F. Caching multidimensional queries using chunks. In Proceedings of the 1998 ACM SIGMOD International Conference on Management of Data, 259–270 (1998).
  • 21.Hasan, K. A., Tsuji, T. & Higuchi, K. An efficient implementation for molap basic data structure and its evaluation. In International Conference on Database Systems for Advanced Applications, 288–299 (Springer, 2007).
  • 22.Zhang Y, et al. Virtual denormalization via array index reference for main memory olap. IEEE Trans. Knowl. Data Eng. 2015;28:1061–1074. doi: 10.1109/TKDE.2015.2499199. [DOI] [Google Scholar]
  • 23.Zhang R, Kalnis P, Ooi BC, Tan K-L. Generalized multidimensional data mapping and query processing. ACM Trans. Database Syst. (TODS) 2005;30:661–697. doi: 10.1145/1093382.1093383. [DOI] [Google Scholar]
  • 24.Yang, Z., Li, X., Zhang, X., Luo, W. & Li, K. K-truss community most favorites query based on top-t. World Wide Web 1–21 (2022).
  • 25.Pei S, et al. B h bf: A bloom filter using b h sequences for multi-set membership query. ACM Trans. Knowl. Discov Data (TKDD) 2022;16:1–26. doi: 10.1145/3502735. [DOI] [Google Scholar]
  • 26.Xiao G, Li K, Zhou X, Li K. Efficient monochromatic and bichromatic probabilistic reverse top-k query processing for uncertain big data. J. Comput. Syst. Sci. 2017;89:92–113. doi: 10.1016/j.jcss.2016.05.010. [DOI] [Google Scholar]
  • 27.Lin P, et al. Personalized query techniques in graphs: A survey. Inf. Sci. 2022;607:961–1000. doi: 10.1016/j.ins.2022.06.023. [DOI] [Google Scholar]
  • 28.Hore B, Mehrotra S, Canim M, Kantarcioglu M. Secure multidimensional range queries over outsourced data. VLDB J. 2012;21:333–358. doi: 10.1007/s00778-011-0245-7. [DOI] [Google Scholar]
  • 29.Smith, S. et al. FROSTT: The formidable repository of open sparse tensors and tools; http://frostt.io/tensors (2017).

Associated Data

This section collects any data citations, data availability statements, or supplementary materials included in this article.

Data Availability Statement

The datasets that are used in this experiment are of the following two sources. The 4D data set is a 4-order tensor with numeric data values. The experiment on 4D data is done with different data sets from the Formidable Repository of Open Sparse Tensors and Tools (FROSTT)29. FROSTT is a collection of publicly available sparse tensor datasets and tools. It can be found at http://frostt.io/tensors. The 6D, 8D and 10D data sets that we used in this experiment are generated automatically using the rand() function of gcc compiler. The datasets can be available from the corresponding author on reasonable request.


Articles from Scientific Reports are provided here courtesy of Nature Publishing Group

RESOURCES