SQL Server Business Intelligence

Tuesday, January 6, 2009

Microsoft Buisness Intelligence Virtual Machine (VPC VHD) v7.1 released

Microsoft Business Intelligence VPC Release 7.1

Yesterday morning I received some information in regards to the latest All Up MS BI VPC R7.1. Now what has changed between release 7 and 7.1, not sure. I know that the files for 7 where dated 7/22 and for 7.1 they are 9/30. The overview file still has not been updated, so you can reference my previous posting of what changed between 6 and 7 - Microsoft Business Intelligence VPC Release 7. According to the email I received it states that there are supposed to be some voice added demos, but I am not seeing them unless it is just the presenter scripts (guess I was thinking of videos, but maybe I am reading this incorrectly). There are also going to be 17 localized versions of the download, but I am not sure when those will be available to access (if at all).


And just a reminder that the Administrator password is the generic Microsoft one pass@word1 and this VPC has a time bomb of April 15, 2010. This VPC is using Windows 2003 Server R2 SP2 Enterprise Edition, PPS 2007 with SP1, PAS 6.3 with Hotfix 2215, and SQL Server 2005 Enterprise Edition with SP2 (actually build 3068 – SQL Server 2005 Build List). You will need to update this with PPS SP2 and ProClarity SP2 (Hotfix 2217) if you want to have them included - PerformancePoint Server (PPS) 2007 SP2 now available.


Business Intelligence Demo Solution – Overview and Presenter Script information (view my previous posting for the latest update on the Overview that I posted above):


UPDATE (12/28/2008): If for some reason these download links do not work for you you can head over to Russell Christopher's PerformancePoint Blog for a different set of download links - All Up BI VPC 7.1 Available for Public Download. The links that I reference above could be for the older version 7 and not 7.1 which Russell references in his posting here:

Part 1

Part 2

Part 3

Part 4

Part 5

Part 6

Part 7


http://denglishbi.spaces.live.com/blog/cns!CD3E77E793DF6178!832.trak

Sunday, January 4, 2009

Data Warehousing Overview presentation

Click to move to next slide.
Click the Full Screen viewer at the bottom right corner.

'Calculated Member' feature in SSAS

SSRS Drill Down

Wednesday, September 17, 2008

SQL Server DO's and DON'Ts

 clipped from www.codeproject.com

SQL Server DO's and DON'Ts

So, you are now the leader of a SQL Server based project and this is your first one, perhaps migrating from Access. Or maybe you have performance problems with your SQL Server and don't know what to do next. Or maybe you simply want to know of some design guidelines for solutions using SQL Server and designing Database Access Layers (DAL): this article is for you.

Even if you are not using SQL Server, most of these design guidelines apply to other DBMS, too: Sybase is a very similar environment for the programmer, and Oracle designs may benefit from this too. I won't show here how to use specific T-SQL tricks, nor won't give you miracle solutions for your SQL Server problem. This is by no means a complete, closed issue. What I intend to do is give you some advices for a sound design, with lessons learned through the last years of my life, seeing the same design errors being done again and again.

DO know your tools.

Please, don't underestimate this tip. This is the best of all of those you'll see in this article. You'd be surprised of how many SQL Server programmers don't even know all T-SQL commands and all of those effective tools SQL Server has.

"What? I need to spend a month learning all those SQL commands I'll never use???" you might say. No, you don't need to. But spend a weekend at MSDN and browse through all T-SQL commands: the mission here is to learn a lot of what can and what can't be done. And, in the future, when designing a query, you'll remember "Hey, there's this command that does exactly what I need", and then you'll refer again to MSDN to see its exact syntax.

In this article I'll assume that you already know the T-SQL syntax or can find about it on MSDN.

DON'T use cursors

Let me say it again: DON'T use cursors. They should be your preferred way of killing the performance of an entire system. Most beginners use cursors and don't realize the performance hit they have. They use memory; they lock tables in weird ways, and they are slow. Worst of all, they defeat most of the performance optimization your DBA can do. Did you know that every FETCH being executed has about the same performance of executing a SELECT? This means that if your cursor has 10,000 records, it will execute about 10,000 SELECTs! If you can do this in a couple of SELECT, UPDATE or DELETE, it will be much faster.

Beginner SQL programmers find in cursors a comfortable and familiar way of coding. Well, unfortunately this lead to bad performance. The whole purpose of SQL is specifying what you want, not how it should be done.

I've once rewritten a cursor-based stored procedure and substituted some code for a pair of traditional SQL queries. The table had only 100,000 records and the stored procedure used to take 40 minutes to process. You should see the face of the poor programmer when the new stored procedure took 10 seconds to run!

Sometimes it's even faster to create a small application that gets all the data, proccess it and update the server. T-SQL was not done with loop performance in mind.

If you are reading this article, I need to mention: there is no good use for cursors; I have never seen cursors being well used, except for DBA work. And good DBAs, most of the time, know what they are doing. But, if you are reading this, you are not a DBA, right?

DO normalize your tables

There are two common excuses for not normalizing databases: performance and pure laziness. You'll pay for the second one sooner or later; and, about performance, don't optimize what's not slow. Often I see programmers de-normalizing databases because "this will be slow". And, more frequent than the inverse, the resulting design is slower. DBMSs were designed to be used with normalized databases, so design with normalization in mind.

DON'T SELECT *

This is hard to get used, I know. And I confess: often I use it; but try to specify only the columns you'll need. This will:

  1. Reduce memory consumption and network bandwidth
  2. Ease security design
  3. Gives the query optimizer a chance to read all the needed columns from the indexes

DO know how your data will be/is being acessed

A robust index design is one of the good things you can do for your database. And doing this is almost an art form. Everytime you add an index to a table, things get faster on SELECT, but INSERT and DELETE will be much slower. There's a lot of work in building and mantaining indexes. If you add several indexes to a table to speed your SELECT, you'll soon notice locks being held for a long time while updating indexes. So, the question is: what is being done with this table? Reading or Updating data? This question is tricky, specially with the DELETE and UPDATE, because they often involve a SELECT for the WHERE part and after this they update the table.

DON'T create an index on the "Sex" column

This is useless. First, let's understand how indexes speed up table access. You can see indexes as a way of quickly partitioning a table based on a criteria. If you create an index with a column like "Sex", you'll have only two partitions: Male and Female. What optimization will you have on a table with 1,000,000 rows? Remember, mantaining an index is slow. Always design your indexes with the most sparse columns first and the least sparse columns last, e.g, Name + Province + Sex.

DO use transactions

Specially on long-running queries. This will save you when things get wrong. Working with data for some time you'll soon discover some unexpected situation which will make your stored procured crash.

DO beware of deadlocks

Always access your tables on the same order. When working with stored procedures and transactions, you may find this soon. If you lock the table A then table B, always lock them in this very same order in all stored procedures. If you, by accident, lock the table B and then table A in another procedure some day you'll have a deadlock. Deadlocks can be tricky to find if the lock sequence is not carefully designed.

DON'T open large recordsets

A common request on programming forums is: "How can I quickly fill this combo with 100,00 items?". Well, this is an error. You can't and you shouldn't. First, your user will hate browsing through 100,000 records to find the right one. A better UI is needed here, because you should ideally show no more that 100 or 200 records to your users.

DON'T use server side cursors

Unless you know what your are doing. Client side cursors often (not always) put less overhead on the network and on the server, and reduce locking time.

DO use parametrized queries

Sometimes I see in programming forums, questions like: "My queries are failing with some chars, e.g. quotes. How can I avoid it?". And a common answer is: "Replace it by double quotes". Wrong. This is only a workaround and will still fail with other chars, and will introduce serious security bugs. Besides this, it will trash the SQL Server caching system, which will cache several similar queries, instead of caching only one. Learn how to use parameterized queries (in ADO, through the use of the Command Object, or in ADO.NET the SqlCommand) and never have these problems again.

DO always test with large databases

It's a common pattern programmers developing with a small test database, and the end user using large databases. This is an error: disk is cheap, and performance problems will only be noticed when it's too late.

DON'T import bulk data with INSERT

Unless strictly necessary. Use DTS or the BCP utility and you'll have both a flexible and fast solution.

DO beware of timeouts

When querying a database, the default timeout is often low, like 15 seconds or 30 seconds. Remember that report queries may run longer than this, specially when your database grows.

DON'T ignore simultaneous editing

Sometimes two users will edit the same record at the same time. When writing, the last writer wins and some of the updates will be lost. It's easy to detect this situation: create a timestamp column and check it before you write. If possible, merge changes. If there is a conflict, prompt the user for some action.

DON'T do SELECT max(ID) from Master when inserting in a Detail table.

This is another common mistake, and will fail when two users are inserting data at the same time. Use one of SCOPE_IDENTITY, IDENT_CURRENT, and @@IDENTITY. Avoid @@IDENTITY if possible because it can introduce some nasty bugs with triggers.

DO Avoid NULLable columns

When possible. They consume an extra byte on each NULLable column in each row and have more overhead associated when querying data. The DAL will be harder to code, too, because everytime you access this column you'll need to check

I'm not saying that NULLs are the evil incarnation, like some people say. I believe they can have good uses and simplify coding when "missing data" is part of your business rules. But sometimes NULLable columns are used in situations like this:

CustomerName1
CustomerAddress1
CustomerEmail1
CustomerName2
CustomerAddress2
CustomerEmail3
CustomerName1
CustomerAddress2
CustomerEmail3

This is horrible. Please, don't do this, normalize your table. It will be more flexible and faster, and will reduce the NULLable columns.

DON'T use the TEXT datatype

Unless you are using it for really large data. The TEXT datatype is not flexible to query, is slow and wastes a lot of space if used incorrectly. Sometimes a VARCHAR will handle your data better.

DON'T use temporary tables

Unless strictly necessary. Often a subquery can substitute a temporary table. They induce overhead and will give you a big headache when programming under COM+ because it uses a database connection pool and temporary tables will last forever. In SQL Server 2000, there are alternatives like the TABLE data type which can provide in-memory solutions for small tables inside stored procedures too.

DO learn how to read a query execution plan

The SQL Server query analyzer is your friend, and you'll learn a lot of how it works and how the query and index design can affect performance through it.

DO use referential integrity

This can be a great time saver. Define all your keys, unique constraints and foreign keys. Every validation you create on the server will save you time in the future.

Conclusion

As I've said before, this is by no means a complete SQL Server performance and best practices guide. This would take a complete book to cover. But I really believe that this is a good start, and if you follow these practices, surely you will have much less trouble in the future.

Get Clipmarks - The easiest way to email text, images and videos you find on the web.
Sent with Clipmarks

Calling a Web Service from an SQL Integration Services package

 clipped from www.codeproject.com
Calling a Web Service from an SQL Integration Services package

Introduction

The SSIS framework provides the Web Service task which executes a Web service method. You can use the Web Service task for the following purposes:

  • Writing to a variable the values that a Web service method returns.
  • Writing to a file the values that a Web service method returns

Image1.jpg

This article defines a step by step approach to use web service call in SQL integration services.

  • Create a web service project

image2.jpg

Figure 2 - Create Web Service

  • Expose method call in the web service
    public class SSISService : System.Web.Services.WebService {         [WebMethod]         public string HelloMoon()         {             return "Hello Moon";         }         [WebMethod]         public int Multiply(int nParam1, int nParam2)         {             return nParam1 * nParam2;         } }
  • Create SSIS package

image3.jpg

Figure 3 - Create SSIS Package

  • Add web service task

image4.jpg

Figure 4 - SSIS Toolbox

image5.jpg

Figure 5 - Web Service Task

  • Modify the web service task

image6.jpg

Figure 6 - Edit Web Service Task

image7.jpg

Figure 7 - Web Service Task Editor

  • Define the HTTP Connection.

image8.jpg

Figure 8 - HTTP Connection Manager Editor

  • Define the WSDL File

image9.jpg

Figure 9 - Web Service Task Edit (Definition of WSDL file)

  • Define the Web Service Task Inputs

image10.jpg

Figure 10 - Web Service Task Editor (Definition of web service input properties

  • Define the Web Service Output

The output of the web service can be written to variables or output file. This sample outputs the results from the web service to a file system file that is defined using the File Connection Manager Editor (Figure 11)

image11.jpg

Figure 11 - Web Service Task Editor (Definition of web service output properties)

image12.jpg

Figure 12 - File Connection Manger

  • Result

The following is the encoded output from the web service stored in the test.txt file.

<?xml version="1.0" encoding="utf-16"?>

<int>200</int>

References

[1] Web Service Task, SQL Server 2005 Books Online, http://msdn2.microsoft.com/en-us/library/ms140114.aspx

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Get Clipmarks - The easiest way to email text, images and videos you find on the web.
Sent with Clipmarks

Tuesday, September 16, 2008

Performance Tuning Tips for SQL Server BCP

Performance Tuning Tips for SQL Server BCP

By : Brad McGehee
Jan 18, 2007

If you need to import or export very large quantities of data, it is often much faster to use bcp that it is to use DTS or SSIS. Of course, bcp lacks many features and options available for DTS and SSIS, and it a little more time-consuming to set up sometimes. But if you don't need to manipulate data, or if you deal with large amounts of data, or if you need a simple way to transfer data using a command line option, then you should investigate using bcp. [7.0, 2000, 2005] Updated 6-12-2006

*****

If appropriate, use the BCP native format instead of the character format to import and export data. It is much faster. Of course, this will limit you to BCP data between SQL Server databases with the same Character Sets and Dictionary Sort order. [6.5, 7.0, 2000, 2005] Updated 6-12-2006

*****

If appropriate, use the BCP fast mode to import data. The fast mode can save you substantial time for your data loads. Because there is no "fast mode" option to turn on, you must take all of the following steps to use the BCP fast mode:

·         The "select into/bulkcopy" database option must be set to "true".

·         The target table should not have any indexes.

·         The target table must not be published for replication.

·         Use the TABLOCK to lock the target table.

Get Clipmarks - The easiest way to email text, images and videos you find on the web.
Sent with Clipmarks