Abstract : As Conventional DBMS stores data in rows and columns and than the data is accessed using SQL and than further computations are made on the accessed data . So for any computation to be made on database would have an extensive procedure of accessing the data from database and the computing it selecting the right data from the result set
An alternative for this approach is suggested here, where in the defined functions of a particular tables is already computed and stored in the table (SMART database Table) which is interactive and completely defined by the user
Explanation:
Below is an example of a table of conventional RDBMS . Say here we are storing information of employee salary
Employee Name | Employee ID | Designation | Salary
|
SAMARTH | 4238 | Consultant | 10000 |
MARC | 4225 | Trainee | 45000 |
SAMUEL | 4328 | Assistant Manager | 52000 |
ABHISHEK | 4694 | Management Consultant | 60000 |
AHMED | 4998 | Finance Manager | 6234 |
STEVE | 4326 | Software Engineer | 3529 |
SAMEER | 4521 | Area Manager | 9000 |
Any new data here is added to the table using normal “INSERT” statements and accessed using SQL “SELECT”
Suppose we have an application designed based on this database table which gives the SUM of Salary of Employees receiving more than 10000 This shall be done with the following Approach:
WHILE (END OF TABLE)
{
RESULT:SELECT ALL FROM EMPLOYEE TABLE; (//Selects the entire of row and stores in RESULT array)
REL_SAL=RESULT(SALARY);(//The salary data of the result set is stored in REL_SAL)
IF(REL_SAL>10000)
{
REL_SAL= REL_SAL;
}
ELSE
{
REL_SAL=0;
}
REL_SAL= REL_SAL+ REL_SAL;
}
END
( The above code is written only for description and may not be logically and is not syntactically correct)
With the above approach the database is queried equal to the number of rows present in the table in row based database where as in a column based database the number of queries may be relatively less
Approach with SMART Database Table:
With this approach we add more functionalaity to the Database Table
Say we have SMART Database Table like this
Employee Name | Employee ID | Designation | Salary |
SAMARTH | 4238 | Consultant | 10000 |
MARC | 4225 | Trainee | 45000 |
SAMUEL | 4328 | Assistant Manager | 52000 |
ABHISHEK | 4694 | Management Consultant | 60000 |
AHMED | 4998 | Finance Manager | 6234 |
STEVE | 4326 | Software Engineer | 3529 |
SAMEER | 4521 | Area Manager | 9000 |
Sum of Salary | 185763 | Sum of Salary of employees more than 10000 | 157000 |
The above database table varies from the conventional database it has special locations and functionalities within the table. Details of the changes as discussed below:
1)An event listener for the table which can be activated and made to trigger a defined function
2)User defined functions for tables which can be executed as users request
3)Additional locations within the table to store result sets before hand
For Example:
The Event listener hears for database INSERT events and triggers a function which checks for the Salary Data and ADDS up to the variable if Salary data if it is more than 10000 :-
ACTIVATE INSERT_EVENT; (//An event is activated that hears for INSERT statement)
INSERT_EVENT.FUNCTION=APP_SAL(); (// A function, APP_SAL() is assigned to the INSERT_EVENT to trigger whenever INSERT is executed)
FUNCTION APP_SAL()(//Function APP_SAL() is defined)
{
VALUE=INS_SAL; (//Salary data is accessed with INS_SAL and assigned to VALUE)
IF (VALUE>10000)
{VALUE=VALUE+VALUE;}
ELSE
{VALUE=VALUE;}
Sum of Salary of employees more than 10000.SET_VALUE=VALUE;
}
END
As explained with the above approach the required end result is calculated and maintained with each insert queries
Advantages of the above approach:
1. Statistically on any database the number INSERT queries are less and hence the number of events triggered and functions executed will be less resulting in lesser usage of computing resource
2. The results of applications are integrated with the table itself and constantly updated there by making results readily available without the need of repeated queries which is hard on database
Also the available result could be accessed with negligeable delay with latest INMEMORY database