|
so, index is the best for my project ?
am i right ?
|
|
|
|
|
An index and the use of parameter queries are NOT mutually exclusive, you can (and should) use both techniques for your solution. Yes, an index will give you the performance results you want.
Remember, if your table has the Primary Key defined as the Barcode, then no additional index is required. By defining a primary key the DBEngine will automatically create a unique index for you behind the scenes.
Try it out, you can always create and drop an index to test for any differences in response time.
|
|
|
|
|
Parameter helps you to reuse the SQL statement, index provides faster access to desired rows, but also has it's own downsides.
The need to optimize rises from a bad design.
My articles[ ^]
|
|
|
|
|
Hi All
I have a question, I have 2 offices one in botswana and one in South Africa, I am building an intranet for our company that will handle our logistics information, users will logon to the same website or a clone of the website depending on thier country, I want to set something up so users in botswana use that databse and users in south africa use the db in SA, but the data must somehow come together so users in botswana can see the RSA data loaded and vice/versa problem is the line speed from botswana to south africa sucks so the main reason I want 2 databases is for speed of the website in botswana. Any Ideas besides replication maybe clustering of somekind.
Also should run SQL 2000 or 2005 still desiding what DB will be best to use license wise or so on.
|
|
|
|
|
I would highly recommend SQL 2005 over 2000. It is much faster and contains more features that have made my life so much better. Regarding your design, I would tend to look at having 2 separate databases each local to your individual office. Depending on your DB design, you may want to roll your own replication logic and schedule updates between the two sites. The other thing to consider is if you are going to develop your sites with ASP.NET, you can look into the .NET caching object and see if caching will work for you without replicating the data.
Sounds like an interesting challenge.
BTW: I was at Chobe National Park a few years ago and had a really great time; I got some beatuiful pictures of the animals.
|
|
|
|
|
If you want to *split* your database on two separate servers the main problem you have is logical, not technical.
First you must find a way to separate rows on tables so that it's rare that people in Botswana need (especially update, insert or delete) the rows that are maintained in South Africa. Typically this is done using different kinds of responsibility information and so on. Otherwise you will have lot's of update collisions which will be very problematic and require a reliable, (potentially) high speed connection between sites.
After you have found a way to logically separate the data you can use several techniques (few options with some of their good and bad effects):
- replication, which allows you to loose connection for a while, but has problems since data is (commonly) duplicated
- distributed operations with two-phase commit, data is consistent, but loss of connection may paralyze the system also typically needs modifications at program level
- federations, data is consistent and no need to change the program. Also workload is divided between sitse. Loss of connection may paralyze the system (depending how program handles this)
Hope this helps,
Mika
The need to optimize rises from a bad design.
My articles[ ^]
|
|
|
|
|
I d´ont know but i really d´ont like replication to
I think you have a problem there i d´ont see how you can get "the best of two worlds"!!!
I would create a parent database and child databases (1 or more doesn´t matter). But, i would really in fact create one database, the parent one.
So, let the users connect to the database, if sucess ok else let it connect to the child database.
The child database would trigger a check (say every 5 min) in the parent to see if can connect, if so update parent: empty the child and fill parent with data. Invest in datetime variables here to get records ordered!
But, it can get really messy if you critical data (when you can´t make something before others or same time) let only connect to parent database then.
That´s for editing procedures, for report procedures make whatever, just show all you got(data), display the report date and if is a "blue-print", not 100% check accurate
good luck
nelsonpaixao@yahoo.com.br
trying to help & get help
|
|
|
|
|
Hello all.
I am interested in hearing about other's experiences with CLR Stored Procedures (C#, VB.NET, whatever) in SQL 2005. Positive, negative, no difference. Better with single-tables than with large joins. Techniques and optimizations. What worked and did not work and why. What things they are better for than others (i.e. heavy mathematical or string operations). Etc.
I am also posting a small message in the C# forum to see if any developers over there have experience and would like to come over here to share.
I am looking to see if any of my operations can be optimized by changing them to CLR-based SPs. But rather than go the shotgun approach and rewrite everything, I want to get the best bang for my buck, and figured starting here would be a good idea.
Thanks!
Peace!
-=- James Please rate this message - let me know if I helped or not!<hr></hr> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
James R. Twine wrote: I am looking to see if any of my operations can be optimized by changing them to CLR-based SPs.
Not sure I understand your question. SQL Server (and others) have supported developing stored procedures using external languages like C/C++ for many years now. What differentiation are you making between that and using a CLR based language for developing stored procedures?
led mike
|
|
|
|
|
I know about Extended Stored Procedures and have even written/used them in the past.
CLR-based SPs run in the .NET environment, and even though it is hosted by SQL Server, they can be considered more stable because errors/exceptions cannot cause instabilities in the XP server's executable (stepping on its memory, for example). This is one reason why they may be more attractive, especially if deploying them to a server that is used for other purposes at a client site.
They also may work faster (other than the initial compilation hit) on systems that would normally run a XSP in a separate process because the cross-process overhead is eliminated (somewhat). CLR-based objects can be used as UDTs.
Anyway, the part of my post that you quoted was miswritten - of course I can optimize some of my operations. The question is more along the lines of what KINDS of operations are likely to be sped up by moving to a CLR-based SP. I am not trying to compare the performance of XSPs vs. CLR-SPs.
Peace!
-=- James Please rate this message - let me know if I helped or not!<hr></hr> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
CLR based code may/will be useful for the areas where TSQL is not optimised; that is procedural code, string handling and complex calculations. You also have access to .NET Framework classes for registry, files, XML etc.
Comparing the performance of XSPs and CLR is probably moot anyway since XSPs are deprecated in SQL 2005 onwards.
|
|
|
|
|
I've used CLR integration for several cases and I have to say that I have totally discarded using plain C so my answer may be a bit biased .
I like to use normal T-SQL procedures and plain SQL especially when transactional processing is needed and/or when working with result sets. T-SQL performs better in these areas. What I typically do, is that I only 'extend' T-SQL with C# based functionality, not replacing it. Some of the usages have been:
- complex mathematical functions not implemented in T-SQL. Using these for columns in result sets
- integration to the database server or even to the client calling the db
- file handling capability for stored procs (and also logging)
- extended string handling (T-SQL is actually very lousy in this) etc.
The negative aspects I see are:
- integration to the actual connection calling CLR based functionality. It's working, but for some reason not very intuitive (at least not for me)
- installation is a bit difficult if it's meant to be done by client. Creating a full silent install script for the whole database server requires more work than I originally expected
- cannot use fibers so in some installations it may cause performance problems on other areas of database usage
Mika
The need to optimize rises from a bad design.
My articles[ ^]
|
|
|
|
|
Suppose a left table name is: tblstudent. Which has two column , studentID(KEY) and studentName. On the other hand right table name is tblMarks. In this first column is studentID(key) and second column is ‘Division’ of type bit. The student who got First class , with his respective name , Division value is entered 1.But student, who did not get First class, not entered in the table. Now what should be the query that presents first column all student name from left table(tblstudent) and second column Division with respect to name. Student who not get first class present as null value.
|
|
|
|
|
You are joking of course. Why would anyone want to do your homework for you? Without even a please?
Bob
Ashfield Consultants Ltd
|
|
|
|
|
To prevent that he understands what he is doing, in order to prevent him from getting a degree. If that fails, one of us might end up maintaining that code..
So, by all means, let's just answer all homework-questions
--edit--
Answers only, off course! Explanation of an answer wouldn't help. If one does not want to learn, then don't push an explanation. Forced learning is plain rude
|
|
|
|
|
Tell you what, shall we set up a website to answer just homework questions - obviously, as they are students we wouldn't charge, and we could give up our paying jobs to run it? Just think of how many degress we could be responsible for globally!
Of course, as we are (more or less) in the same time zone we would have to employ people (out of our own pockets, naturally) to answer urgent (aren't they always) questions during the European night.
Good plan?
Bob
Ashfield Consultants Ltd
|
|
|
|
|
That has been tried already, with various setups.. StackOverflow for the students, Rent-a-coder for the "urgentz codez". Aw, wait, Rent-a-coder isn't free, is it?
..the sad thing is, what you are describing is almost what we are doing now.
|
|
|
|
|
SELECT tblStudent.StudentID, tblStudent.StudentName, tblMarks.Division FROM tblStudent LEFT OUTER JOIN tblMarks ON tblStudent.StudentID = tblMarks.StudentID
|
|
|
|
|
In which database u want to run this???
following is for MS-Access
-----------------------------
SELECT [studentName], [Division]
FROM tblstudent LEFT JOIN tblMarks ON [tblstudent].[studentID]=[tblMarks].[studentID];
"We can't solve problems by using the same kind of thinking we used when we created them"
|
|
|
|
|
just grab a chair, i will post you the entire code in a few minutes ok?
nelsonpaixao@yahoo.com.br
trying to help & get help
|
|
|
|
|
i m using Visual studio 2005.here i am having a problem that i have a RadioButtonList which retrives data from sql datasource. it displays the Items correctly.Now when i try to display the SelectedItems on a label i get an error.kindly help me m stuck..m a student a really new to it.please help..thanx a lot...
|
|
|
|
|
Ok, a couple of things
1. This isn't a sql question, its either vb.net or c#, depending on what you are using - you state the data is being retrived correctly, so there is no sql problem
2. With no code and no error message how can anybody work out what is wrong?
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Its hard to help when one has no idea what kind of error you are getting. Please paste the line that you are using to display the SelectedItems on the label or the error. It could be something minor that you are not taking into consideration.
|
|
|
|
|
the error i am getting on browser page is :-
"Server Error in '/Website_dtc' Application.
--------------------------------------------------------------------------------
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
"
the RadiobuttonList is databound as follows-
"RadioButtonList1.DataSource = ds.Tables["temp1"];
RadioButtonList1.DataTextField = "buses";
RadioButtonList1.DataValueField = "buses";
RadioButtonList1.DataBind();
"
the RadiobuttonList Item is selected as:-
" protected void Button1_Click(object sender, EventArgs e)
{
lbltemp.Text = RadioButtonList1.SelectedItem.Text;
}
"
|
|
|
|
|
At a guess, either
a) you haven't selected anything in the list
or
b) you rebind the list each time the page loads, thus overwriting the selection... Might want to have a look at the IsPostBack page variable.
|
|
|
|