14
votes
Accepted
A wounded Zombie finder, or: how to find the almost dead undead?
Not utterly wrong, but
q.PostTypeId = 1
and
AND a.PostTypeId = 2
are superfluous. The only post types with a non-null ...
9
votes
Accepted
App for providing accounting solutions for clients
You only asked for suggestions how to make this code faster. However, after discussing what might be the issue with performance here, I will provide some comments regarding general maintainability ...
8
votes
Accounting system data database design
Some quick remarks:
Why the (incomprehensible) prefixes in the table names? Why not use the SCHEMA instead (and use proper words)?
Why are all your table fields ...
7
votes
Accepted
Zombie killers ranking
As a heads up - we have very different formatting styles for our code. Feel free to ignore that difference and don't consider it a comment on your style (unless you prefer mine, in which case please ...
7
votes
NewSequentialId - pure net core 2.2 implementation of sql server function
You want to reduce both computation time and memory allocation. Memory allocation itself takes time, so that's a good place to start -- try to find all the places where you're allocating memory and ...
7
votes
Write SQL Server table to Parquet file
Quick remarks:
Your code doesn't follow the coding conventions (camel-case, pascal-case, etc.).
string SourceObject_IsTable = args[2]; has a bad name and isn't ...
6
votes
Employee Attendance structure design
I would change my parameters to simply require "login" and "logout" timestamps.
Then calculate the difference between those two DateTimes.
I would move all validation into DI ...
5
votes
Accepted
Connection String Decorating
What struck me most are these lines:
p.Name.ToUpper() != name.ToUpper()
I find it's always better to use the Equals overload ...
5
votes
Accepted
Multilingual website with a database
Too many Language Repetitions
You use the "Language" key a lot. What if you decide to rename it sometime? You'll need to search ...
5
votes
Retrieving data from SQL DB based on user input
I don't get the point of the ConnectionString class. Just about any example WRT writing db access code will use a connection string taken from a ...
5
votes
Accepted
The sniper: a Zombie searcher for specific tags
When using "simple" Aliases for table names in a query you should alias all the tables, not just some of them. This makes the query appear more consistent. In your query, you have ...
5
votes
Safe dynamic SQL for generic search
Comments on your approach
The most obvious thing to me is that you're already inserting all of your data into the temp table; why not just join to it? You can dynamically pivot into a better, ...
5
votes
Export sql data to xml and csv
Some quick remarks:
Don't start variable names with underscores unless they're class-wide private ones.
Local variables should be camelCased. ...
5
votes
Retrieving restaurant orders from SQL Server
Quick remarks:
Please follow the Microsoft naming guidelines. Parameters should be camelcase, same with local variables.
Don't write your own ORM or use ADO.NET. Instead, use Dapper.
In the middle ...
4
votes
"How can I make this SEDE query better?" (bad title finder)
Let me address a possible DRY issue in the query in exchange for possible poorer performance.
I'm in particular talking about this bit:
...
4
votes
Accepted
Adding data to database using asp.net and sql-server
I would personally encapsulate your instantiation of MusicStoreDBEntities in a using statement so that the database connection is properly closed and disposed of.
<...
4
votes
Accepted
Adding data to database using ASP.net and SQL-server part 2
Coding/naming conventions:
All the information about this can be found in folllowing article: Naming Guidelines.
Straight from the documentation:
To differentiate words in an identifier, capitalize ...
4
votes
Materiel position query for a war game written in Unity
I don't know how much you're looking to change, but making three separate server calls is going to bite you later on when it turns into a huge bottleneck.
I would recommend making one request, which ...
4
votes
SqlCommand ExecuteReaderAsync helper method
DataContext
[..]the creation of the DataContext seems a bit excessive
Why do you think so? Is creating the SqlCommand not excessive? You are instantiating it the ...
4
votes
Accepted
Creating SQL Indexes on Large Tables
Community wiki because the root of the answer (use an MLT to copy the data) was already in the comments. Shoutout to dnoeth and Der Kommissar for already explaining most of this in the comments.
...
4
votes
Find how much reputation a user had on a given date
This is a partial answer as these were the bits I could verify easily.
In your column query for ReputationFromSuggestedEdits you can move all of the projection to ...
4
votes
Accepted
Inserting data into SQL-Server table dynamically
The main problem with this code is that it's not screening column values, unfortuantely buit in mechanisms in Invoke-SQLCMD aren't viable. It allows to use ...
4
votes
Function to get current value or default from a string of two values
Potential Issues
a naive string replacement could change more than just the placeholders; for instance, when another part of the script uses the same string as a literal
the replacement can introduce ...
4
votes
Accepted
Function to get current value or default from a string of two values
Answering your question
Overall, I think the solution is sound, but there are a few things you could make cleaner. I agree with everything in dfhwze's answer, but assuming this is the route you keep ...
4
votes
Accepted
Excel to SQL server
Time constants
Rather than writing
tick_time_seconds = 300
you're better off using a more expressive built-in:
...
4
votes
Accepted
Export sql data to xml and csv
Your biggest problem targeting performance is the use of string concatenation by using exportCSV +=. Each time such a line will be executed a new string object will ...
4
votes
Receive data from SQL and CSV and send it to MySQL database using Python
Externalize your connection strings
This information:
...
4
votes
Accounting system data database design
Top 100 percent in a view is useless. Get rid of that. It does NOT ensure the order that rows will be returned from the view and logically it wouldn't work anyway as you could have conflicting order ...
3
votes
Accepted
Performance concerns for synchronous action methods
How large does a database have to be with how many calls to it before the async overhead is worth it?
You will have benefits immediately. SQL Server is a multi-user database and even for small/simple/...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
sql-server × 577sql × 460
t-sql × 175
c# × 100
performance × 100
stackexchange × 50
stored-procedure × 41
datetime × 24
beginner × 23
database × 21
asp.net × 18
.net × 14
entity-framework × 14
join × 11
php × 10
time-limit-exceeded × 9
security × 9
ado.net × 9
python × 8
object-oriented × 8
vb.net × 8
java × 7
error-handling × 7
vba × 6
cryptography × 6