Posts

Showing posts from March, 2017

SQL Joins

Image
Joins are used to combine rows from two or more tables based on related columns between them. Joins allow you to retrieve data from multiple tables simultaneously, enabling you to create complex queries that fetch data from different sources. There are different types of joins in SQL, including: INNER JOIN Returns only the rows that have matching values in both tables based on the specified join condition. It discards non-matching rows from both tables. Example:           create table t1(x int); insert into t1 values(1); insert into t1 values(1); insert into t1 values(0); create table t2(y int); insert into t2 values(0); insert into t2 values(1); insert into t2 values(1);           select * from t1 inner join t2 on t1.x = t2.y Output: 2. LEFT JOIN (or) LEFT OUTER JOIN Returns all the rows from the left (or first) table and the matching rows from the right (or second) table. If there is no match, NULL values are

update nodejs

  node -v   sudo  npm cache clean -f   sudo  npm install -g n   sudo n stable or sudo n latest sudo ln -sf /usr/local/n/versions/node/7.6.0/bin/node /usr/bin/node node -v

ag-grid load data

Add New Data to ag-grid agGrid.initialiseAgGridWithAngular1(angular); var app = angular.module('App', ['agGrid']); $scope.gridOptions.api.setColumnDefs(columnDefs); $scope.gridOptions.api.setRowData(rowData); $scope.gridOptions.columnApi.autoSizeColumns(columnDefs); <div ag-grid="gridOptions" class="ag-fresh" style="height: 100px;"></div>

WLM, Summary Tables and Subquery

Work Load Management     By default , redshift cluster is configured with default parameter group with concurrency level of 5 with single queue that means maximum of 5 queries run in parallel in single queue. So suppose you are firing more than five queries than remaining queries will wait untill the query slot getting freed in a queue. With WLM we can have maximum of 8 queue and concurrnecy level of 50 across all the queues. With effective WLM we can maxmize  the query performance , so that the small queries no need to wait untill the long running queries get completed. We cannot add queues in the default parameter group . So in first we need to create our custom parameter group then only only we can define our queues. We can map the query to queue based on either by user who running the query or by query type. query type example. set query_group to 'small'; Summary Tables    Try to work on the summarised data . For example suppose multip

SortKey, DistKey & Compression

Sortkeys Compound Sortkeys Effecient when used in the where conditions are in same order as specified in the sortkey. This is the default sortkey . ex : sortkey (column1, column2) where column1='somevalue' and column2='somevalue'  give better performance than where column2='somevalue' Interleaved Sortkeys Gives equal weightage to all the columns specified in the sortkey. Gives better results than the compound sortkey in the circumstances when cannot able to identity columns used in the where conditions. ex : interleaved sortkey (column1, column2) As time grows the data added to the existing table grows , it will degrade the performance on both the compound and interleved sortkeys , but it has greter effect on interleaved key.Need to Vaccum Reindex sort key tables whenever new data added. http://docs.aws.amazon.com/redshift/latest/dg/r_vacuum-decide-whether-to-reindex.html Distribution Key Defines how rows should be stored across