Speed up database [closed] - sql-server

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I heard, that it is possible to speed up SQL Server by writing all the scripts in one case (UPPER or lower) and turning on special option, that tells Server, that all the commands written in one case.
Is it right? If so, how many benefits it gives? Thanks.

I didn't hear something like that. I think, it's a joke or legend :)

No, definitely not.
There are a couple of related things that might have contributed to this strange claim/rumor:
By default SQL server names are not case-sensitive, but you can set this option at the database level by choosing a case-sensitive collation like "SQL_Latin1_General_CP1_CS_AS". This will make all database object names case-sensitive, but it has no effect on SQL keywords like "SELECT". Note, it will also cause table collations to be case-sensitive by default, so text comparisons will also become case-sensitive unless you choose another collation at the table or comparison level.
It is good practice to specify the object schema in your SQL statements (eg "dbo.SomeTable" instead of just "SomeTable"), and this provides some small performance benefit as it can save SQL server from needing to look for the same object in multiple schemas.

Related

Sorting in asceding order using MS SQL server 2012 [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 4 years ago.
Improve this question
Hello guys i want to sort data in ms SQL server in ascending order and save this change,so if i close the SQL server and reopened the same order should be. Why ??because i need to display sorted data in html page but the easiest way is to sort using MS sql server and then display data in HTML.
SQL standard (so-called ANSI) does not force any default the order results are returned. Meaning, in theory, it could be in any order, different on each run. The intent is that if order is important, then the query must include and order by-clause.
In practice, select * from X (so without explicit order) results tend to be shown in the order they are read from DB internal storage, which quite often is a clustered index. If you really-really want to, you can force DB to lay out data in the order you like be adjusting clustered index. This may or may not be a good idea - you shouldn't do this for querying comfort-reasons, as it has strong impact on performance and should be optimized for real work, not comfort of occasional data-surfing.
I probably do not get your exact need, but "remembering" order in app is usually not done by reordering data is physical DB disk, but handled by application logic and then translated to SQL query as ORDER BY-clause. You app does the remembering, SQL server would do the sorting.

Migration of SQL Server stored procedures to Oracle? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 4 years ago.
Improve this question
I have a question: what is the best practice for migrating SQL Server stored procedures to Oracle?
Thanks.
Best is such a fun word.
But.
Oracle SQL Developer has built in translators, including one for SQL Server.
If you capture your data model using the Migration Projects feature, it will take your T-SQL procedures and convert/translate them to their PL/SQL equivalents.
Each translation will need to be verified/approved/tested, of course.
We see somewhere between 60-90% translation success rates, that is, translated procedures being 'good, out-of-the-box.' Results will vary based on the nature of your code.
I talk about migrations, with Sybase ASE as an example, in this whitepaper. The SQL Server scenario would be pretty much the same.
We also have an ad-hoc translator, but it won't take into account your data model.
I can attest from being involved in a large production legacy project, where substantial number of "automated" options had been evaluated - none of them worked, and almost nothing they did could even be used in the 'at least that' manner.
We wasted a lot of time trying to achieve automation, and then ended up converting everything by hand, which took much less when we involved a small team of coders, once they familiarized themselves with both syntax and optimisers.

Is SQL written for SQLite interchangeable with SQL for an Access database? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I have written a project in C# which currently uses a SQLite database with 7 tables. Now I made a little mistake in selecting my database and since the application is going to be accessed by multiple users (~100) on a network the SQLite solution won't work because only one user can write at a time.
Now I want to switch to an Access (2010) database but my question is:
If I create the Access database with the same scheme as my SQLite database, do I have to change any of the SQL statements that I have written in my application? Or does this work interchangeable?
Also some side notes of why I am switching to an Access database instead of something like a SQL Server... Time does not allow this and costs neither.
Does anyone know what the impact will be if I'd simply replace the SQLite database with the Access database. And are there any differences in the SQL for these two for simple queries? I'm using things like 'INNER JOIN, IS NULL, SUM, COUNT'.
Thanks in advance!
are there any differences in the SQL for these two for simple queries?
For the simplest of queries, not really. For example, the specific language features you mentioned (INNER JOIN, IS NULL, SUM, COUNT) will likely work without modification, with the possible exception that Access SQL often requires parentheses when a statement contains multiple JOINs (example here).
Does anyone know what the impact will be if I'd simply replace the SQLite database with the Access database.
That is impossible to predict without a complete code review. You will really just have to try it and see what (if anything) breaks.

sql server: one file for all the application or is it better to make it multiple db files? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
is it better to put different parts of the app in seperate databases or in a single database file. for example putting forum tables in one database file and putting the blogs tables in another db ??
Separate databases probably don't make sense but, assuming SQL Server 2005 or later, I would encourage you to look into using schemas to logically separate these functional areas. See Buck Woody's article SQL Server Best Practices: User-Defined Schemas as a starting point.
is it better to put different parts of the app in seperate databases or in a single database file
Ah - waht exactly do you ask here? Is this about DATABASES or about DATABASE FILES - a database can have many filegroups which each can have many files.
Depends on size and IO requirements. I have seen databases with 28 groups of multiple files each, to optimize the IO bandwidth of the underlying SAN which was limiting every LUN (and that had multiple files per LUN) to 256 outstanding requests.
if you get into higher end requirements, that makes sense. Likely for you it does not, as your working indicates you dont really know databases, and so you wont work on a multi terabyte high end system ;)

Is Making a DLL compatible to all databases a good idea [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 2 years ago.
Improve this question
I have been given an assignment to get the feasibility for making a dll which takes some inputs such as database name (Mysql, access, sql, oracle etc.) and some more inputs to generate a query, and based on that the dll should return a recordset to the application.
Is it a good idea? If yes, then what inputs should I consider?
It's completely feasible, the issues arise when you encounter different SQL grammars - take a look at how Hibernate handles this with the use of Dialects.
The popular databases - Oracle, Sybase, MS SQL Server, MySQL - have slight differences in the SQL grammar they allow. Essentually the vendors have implemented and extended ANSI SQL in different ways.
The simplest case I can think of is when the way you assign pseudonyms to column names, some databases require this:
SELECT x AS y FROM some_table
while others require:
SELECT x y FROM some_table
There's many more such examples, but the bottom line is that when writing a query abstraction layer that works across all databases you need to abstract the concept of SQL generation so that it can be tailored to each database you are going to support (as I said, Hibernate does this by allowing you to specify a dialect specific to the database you are using).

Resources