http://goo.gl/EmKxy0

Archive

Posts Tagged ‘IQ’

Sybase Interview Ques Updated!!

February 21st, 2011 No comments

Guys,

Updated the Sybase ASE/Rep Interview Question Page which I came across recently.

Please have a look @  http://sybaseblog.com/interviewquestions/

Happy Learning !!

sybanva

Default,Rules and User Defined Datatype

February 6th, 2011 No comments

Question
=======
Consider a table creation script
create table table1(id int not null,
cost smallmoney default $10
)
will it allow null value in column “cost”?

Answer
======
No

Source (Unleashed)
Question
=======
How to find all tables and columns which are bind with a rule/default?
Answer
======
select “table”=o.name, “column”=c.name,”user”=user_name(uid),”rule”=object_name(domain)
from sysobjects o,syscolumns c
where o.id=c.id
and object_name(c.domain)=’rule/default name’

Sequence of events when using datatypes
=================================
sp_addtype ssn_type, ‘char(9)’, ‘not null’
go

create rule ssn_rule as
@ssn between ’001111′ and ’1111111′
or @ssn = ‘N/A’
go

create default ssn_default as
‘N/A’

sp_bindrule ssn_rule,ssn_type
sp_bindefault ssn_default,ssn_type

create table ssn_table
(ssn ssn_type, name varchar(30))
go
==================
A rule or default bound explicitly to a column override a rule or default bound to a datatype. A subsequent bind to the datatype replaces the bind to the column as long as the column and datatype have the same rule or default prior to modification.

Renaming Objects

February 6th, 2011 No comments

(Source – Unleashed)
Question
=======
If name of table is changed then stored procedure and views would work or will change to invalid state?

Answer
======
Even though the name of table has changed, objects like views and procedures that refer to that table by name are not affected by the change in the name. That is because SQL-based objects like Views and Procedures are stored both as text in the syscomments table and pre-parsed query tree identifying related objects by ID instead of Name. When a table name changes, a dependent view still works because the objectID of the table (stored in sysobjects) does not change.

Performance Tuning – Scenario Based

February 1st, 2011 No comments

Suppose we have a join order as below in our query
#tmp > Table1 > Table2>
but query plan would be making join order as below
Table1 > Table2 > #tmp
and it would be causing a whole index scan on both the tables Table1 and Table2 (which is as per the people expectation) before we use temp table to filter out results. However, still we can get performance improvement.
Solution –> We can use “set forceplan on” to force the join order. Though we will have table scan on Table1 and Table2 because of “forcing”, we still could get the performance improvement by avoiding index scan on the large tables Table1 and Table2 because table scan on less number of records (due to filteration by #tmp table) can be faster than index scan on large number of records.

Joins Algorithms

January 28th, 2011 4 comments

Source : sybase.com and www

Time Complexity of Nested Loop Join Algo : O(N * M)

Time Complexity of a HASH JOIN is O(N + M), where N is the hashed table and M the is lookup table. Hashing and hash lookups have constant complexity.

Time Complexity of a MERGE JOIN is O(N*Log(N) + M*Log(M)): it’s the sum of times to sort both tables plus time to scan them.

Hash Join Algo
====================
The hash join algorithm builds an in-memory hash table of the smaller of its two inputs, and then reads the larger input and probes the in-memory hash table to find matches, which are written to a work table. If the smaller input does not fit into memory, the hash join operator partitions both inputs into smaller work tables. These smaller work tables are processed recursively until the smaller input fits into memory.
The hash join algorithm has the best performance if the smaller input fits into memory, regardless of the size of the larger input. In general, the optimizer will choose hash join if one of the inputs is expected to be substantially smaller than the other.

Merge Join Algo
==================
The merge join algorithm reads two inputs which are both ordered by the join attributes. For each row of the left input, the algorithm reads all of the matching rows of the right input by accessing the rows in sorted order.
If the inputs are not already ordered by the join attributes (perhaps because of an earlier merge join or because an index was used to satisfy a search condition), then the optimizer adds a sort to produce the correct row order. This sort adds cost to the merge join.
One advantage of a merge join compared to a hash join is that the cost of sorting can be amortized over several joins, provided that the merge joins are over the same attributes. The optimizer will choose merge join over a hash join if the sizes of the inputs are likely to be similar, or if it can amortize the cost of the sort over several operations.

Nested Loops Join Algo
==================
The nested loops join computes the join of its left and right sides by completely reading the right hand side for each row of the left hand side. (The syntactic order of tables in the query does not matter, because the optimizer chooses the appropriate join order for each block in the request.)

The optimizer may choose nested loops join if the join condition does not contain an equality condition, or if it is optimizing for first-row time.
Since a nested loops join reads the right hand side many times, it is very sensitive to the cost of the right hand side. If the right hand side is an index scan or a small table, then the right hand side can likely be computed using cached pages from previous iterations. On the other hand, if the right hand side is a sequential table scan or an index scan that matches many rows, then the right hand side needs to be read from disk many times. Typically, a nested loops join is less efficient than other join methods. However, nested loops join can provide the first matching row quickly compared to join methods that must compute their entire result before returning.
Nested loops join is the only join algorithm that can provide sensitive semantics for queries containing joins. This means that sensitive cursors on joins can only be executed with a nested loops join.

Categories: ASE, Developement Tags: , , , ,

Data Explosion : R V Ready?

January 25th, 2011 1 comment

We have social networking profiles like orkut, facebook, Linkedin & many more online application.

Have you relized that last 5 years how many profiles have been created ? The number is so big.

Have you relized how much data is stored behind these profiles?

In india, we started using these profile from our generation only. Think the number of user after  two generation and the amount of data due to that.

When we are making a call , when we do shopping, when we do banking, when we accessing social network site and making new profile, we are only creating data.

Do you think, in a sinlge minute how many people do the calls and how many people makes their new profile?
Every minutes we are increasing data.

What you think, we will not crosss tera-peta byte databases very soon?

We will must cross, for that do our existing technologies are capable enough? I cant say yes.

Second thing, it would be very tough to decide the obsolete data,to purge our databases. Isnt it?

We are now  started creating the data very fast, We will certainly need to enhance our technologies, may be
we need to think beyond our existing DB technologies.

Whats your thoughts?

Categories: ASE Tags: , , , ,

Performance Tuning – Scenario Based

January 13th, 2011 No comments

Scenario 1
————
If an application makes multiple statement and each statement calls to a specific stored procedure. Thereby, being a multithreaded application it will call stored procedure multiple times at a time. It has been noticed that for some calls procedure takes longer time for different set of parameters. What could be the issue?

Solution 1
———–
First we can’t blame sqarely on stored procedure for the slower performance. We have few options here
1. Reduce the number of concurrent calls to stored procedure.
2. Check whether the procedure is calling any child procedure with input parameter or not. Suppose child procedure is looking for location and if parent procedure is passing location as an input parameter and while the absence of this input parameter child procedure might be processing all available locations, which could be in huge number, and consuming time. So before calling the child procedure, apply proper check which would reduce the time consumptions for remaining calls.

2010 in review – By WordPress.

January 2nd, 2011 No comments

By WordPress

===============

The stats helper monkeys at WordPress.com mulled over how this blog did in 2010, and here’s a high level summary of its overall blog health:

Healthy blog!

The Blog-Health-o-Meter™ reads This blog is doing awesome!.

Crunchy numbers

Featured image

A helper monkey made this abstract painting, inspired by your stats.

A Boeing 747-400 passenger jet can hold 416 passengers. This blog was viewed about 7,400 times in 2010. That’s about 18 full 747s.

In 2010, there were 25 new posts, growing the total archive of this blog to 32 posts. There were 2 pictures uploaded, taking up a total of 7kb.

The busiest day of the year was April 7th with 72 views. The most popular post that day was ASE/REP/IQ Interview Ques.

Where did they come from?

The top referring sites in 2010 were sybaseteam.com, google.co.in, en.wordpress.com, facebook.com, and google.com.

Some visitors came searching, mostly for sybase iq interview questions, sybase blog, sybase ase interview questions, sybase, and sybase replication server interview questions.

Attractions in 2010

These are the posts and pages that got the most views in 2010.

1

ASE/REP/IQ Interview Ques February 2010
2 comments

2

Cleaning Shared Memory Segment and semaphore, for the ASE startup.. January 2010
2 comments

3

ASE15 New Features – I: DBA Perspective December 2009

4

directio,dsync & sync , async IO April 2010
2 comments

5

Dataserver Health Check Script March 2010

Categories: News Tags: , , , ,

8000+ Hits in sybaseblog.com

December 31st, 2010 No comments

Hi All,

Happy New Year. Let’s spread the growth among everyone.

Categories: ASE Tags: , , , ,

8000+ Hits in sybaseblog.com

December 31st, 2010 No comments

Wishing you a very Happy NewYear 2011.

Todays ur fav blog- sybaseblog.com having 8000+ hits…

Thanks for support  and your valuable time…

Happy Learning  Sybase!

Cheers

sybanva

Categories: ASE Tags: , , , ,