473,804 Members | 3,278 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Should floating point calculations be doing in sql or C#?

Hi,

I would like to know, if I need to do some floting point operations
(mainly multiplication and division) on each roll of a table, should I
read the data out from the DB and do the calculation with a programming
language, say C#, or should I just use sql to do it on the sql server.

An obvious advantage of doing it in the sql server is that you dont
need to transfer the data between the sql server and he application
server.

But I am not sure if there are any other factors that will override
this advantage: like the performance of doing lots of floting point
operations in sql server.

How is the performance of doing floting point operations in sql server
comparing to C# or other languages?

Also are there any other factors that should be considered for this
case and
are there any other advantages to do this is sql server or in c#?

Thanks
Benny

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 20 '05 #1
1 3260
Benny wrote:
Hi,
I would like to know, if I need to do some floting point operations
(mainly multiplication and division) on each roll of a table, should I
read the data out from the DB and do the calculation with a programming
language, say C#, or should I just use sql to do it on the sql server.

An obvious advantage of doing it in the sql server is that you dont
need to transfer the data between the sql server and he application
server.
That's it. The biggest performance mistake with RDBMSes is to treat
them like dumb filing systems. If you can define your operation so
the DBMS can process the table using standard SQL, with set-based
processing, you will be using what DBMSes are designed to do fast.
You build your sawmill where the trees are. The floating point operations
*will* be done in C/C++. That's what the DBMS is written in, and they don't
re-invent the wheel to multiply IEEE floats... If your calculation SQL
is in a stored procedure, it's query plan will be pre-compiled and
ready to re-use.
Joe Weinstein at BEA
But I am not sure if there are any other factors that will override
this advantage: like the performance of doing lots of floting point
operations in sql server.

How is the performance of doing floting point operations in sql server
comparing to C# or other languages?

Also are there any other factors that should be considered for this
case and
are there any other advantages to do this is sql server or in c#?

Thanks
Benny

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
3859
by: anagai | last post by:
hi Isnt it true that floating type can generate rounding errors if the values are rounded to like the 10th decimal. Since currency is rounded only to the 2nd decimal why must i worry about using float for currency calculations? decimal is slow and memory hog. is it true that mysql calculates internally using double float?
687
23778
by: cody | last post by:
no this is no trollposting and please don't get it wrong but iam very curious why people still use C instead of other languages especially C++. i heard people say C++ is slower than C but i can't believe that. in pieces of the application where speed really matters you can still use "normal" functions or even static methods which is basically the same. in C there arent the simplest things present like constants, each struct and enum...
9
2240
by: Klaus Bonadt | last post by:
I have found strange behaviour in casting floating point values in C++ 6.0 to int: If I enter in the watch window while debugging in version 6.0 the following term: (1.4 - 1.0) * 10.0 the result will be 4.0 - as expected. But if I cast the same to int: (int)((1.4 - 1.0) * 10.0)
7
1976
by: Hiten | last post by:
Hi please check ffollowing conditon variable float1 and float2 holds user entered value..... Answer=float1 * float2; //output must be 8.5 output must to be 8.5 but it has 8.500002, i am confused at this point i used calculators and other calculation mathods to see the actual value and thet give correct 8.5 with no other decimals......
9
1783
by: David Veeneman | last post by:
I'm working on a project that uses floating-point values (doubles), and I'm being driven crazy by something pretty basic. I understand that it's in the nature of floating-point calculations to produce values like 0.10000000000000003, when what I really want is 0.1. But is there any way to eliminate that digit at the end? I've tried rounding, but that simply moves the digit to the least significant position, such as 0.1000003. Failing...
3
311
by: alex | last post by:
hi friends ... i am facing a problem while detecting floating point operations in my project, please help me. i want to find out the places in my C/C++ project where i am doing floating point operations. As it is a big project it is not possible to check every line manually, so is there any other method to detect floating point operations in my project?
39
3586
by: rembremading | last post by:
Hi all! The following piece of code has (for me) completely unexpected behaviour. (I compile it with gcc-Version 4.0.3) Something goes wrong with the integer to float conversion. Maybe somebody out there understands what happens. Essentially, when I subtract the (double) function value GRID_POINT(2) from a variable which has been assigned the same value before this gives a non-zero result and I really do not understand why.
6
17095
by: Matthew | last post by:
Hi, I want to change the precision level of floating point variables and calculations which is done in php.ini. However the server I rent for my domain does not give me access to php.ini, they say 'for security reasons'. Can the precision level be changed by PHP code as needed?
6
1503
by: fred8865 | last post by:
Hi all, I understand that due to different arithmetic used in floating points they are just approximations. Hence, 180/100=1 in my python interpreter. How can I tackle this problem of inaccurate floating point numbers? thank you regards xtd
0
9706
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10335
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10323
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10082
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7621
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5652
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4301
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3821
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2993
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.