Fastest Aggregate function when you have series of duplicate values The 2019 Stack Overflow...
Which Sci-Fi work first showed weapon of galactic-scale mass destruction?
What is the accessibility of a package's `Private` context variables?
How come people say “Would of”?
Where to refill my bottle in India?
Why was M87 targetted for the Event Horizon Telescope instead of Sagittarius A*?
Is bread bad for ducks?
Loose spokes after only a few rides
Geography at the pixel level
Do these rules for Critical Successes and Critical Failures seem Fair?
How to support a colleague who finds meetings extremely tiring?
Landlord wants to switch my lease to a "Land contract" to "get back at the city"
For what reasons would an animal species NOT cross a *horizontal* land bridge?
Is three citations per paragraph excessive for undergraduate research paper?
Why is my custom API endpoint not working?
Does the shape of a die affect the probability of a number being rolled?
Can someone be penalized for an "unlawful" act if no penalty is specified?
Why isn't airport relocation done gradually?
Aging parents with no investments
Sci-fi book where a human is taken from Earth to help man an alien ship in a fight against other aliens and rises through the ranks to command
Apparent duplicates between Haynes service instructions and MOT
Why is the maximum length of OpenWrt’s root password 8 characters?
Can you compress metal and what would be the consequences?
What could be the right powersource for 15 seconds lifespan disposable giant chainsaw?
Is a "Democratic" Feudal System Possible?
Fastest Aggregate function when you have series of duplicate values
The 2019 Stack Overflow Developer Survey Results Are In
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
Frequently, I'll need to crunch down a table into a series of aggregates.
And frequently, it will look like this.
John, Smith, Houston, Texas, Order 55, Balloon, 99 dollars
John, Smith, Houston, Texas, Order 55, Bicycle, 400 dollars
In other words, there's the "key column" to group by (order ID in this case).
There's then columns that should be "summed" or "counted" or properly aggregated.
Then there's a bunch of columns that are just duplicated values. This happens a lot and is not necessarily a normalization problem (or you're querying a database like this anyway that you don't admin).
Seems like there's a few choices here. Max(blah), max(ha) max(whatver).
Or min(every column). Obviously since they're all the same, it'll return it.
There's also "group by" each of those duplicate columns. Naturally, this can provide different results depending on your assumptions/ certainty that the columns will be duplicated.
Then there's also, in MySQL only (not MS or Oracle) -- putting nada, and it'll just take the first row found.
Which is typically the fastest? I suppose the best way is to test it. Just wondering though.
sql-server performance query
add a comment |
Frequently, I'll need to crunch down a table into a series of aggregates.
And frequently, it will look like this.
John, Smith, Houston, Texas, Order 55, Balloon, 99 dollars
John, Smith, Houston, Texas, Order 55, Bicycle, 400 dollars
In other words, there's the "key column" to group by (order ID in this case).
There's then columns that should be "summed" or "counted" or properly aggregated.
Then there's a bunch of columns that are just duplicated values. This happens a lot and is not necessarily a normalization problem (or you're querying a database like this anyway that you don't admin).
Seems like there's a few choices here. Max(blah), max(ha) max(whatver).
Or min(every column). Obviously since they're all the same, it'll return it.
There's also "group by" each of those duplicate columns. Naturally, this can provide different results depending on your assumptions/ certainty that the columns will be duplicated.
Then there's also, in MySQL only (not MS or Oracle) -- putting nada, and it'll just take the first row found.
Which is typically the fastest? I suppose the best way is to test it. Just wondering though.
sql-server performance query
add a comment |
Frequently, I'll need to crunch down a table into a series of aggregates.
And frequently, it will look like this.
John, Smith, Houston, Texas, Order 55, Balloon, 99 dollars
John, Smith, Houston, Texas, Order 55, Bicycle, 400 dollars
In other words, there's the "key column" to group by (order ID in this case).
There's then columns that should be "summed" or "counted" or properly aggregated.
Then there's a bunch of columns that are just duplicated values. This happens a lot and is not necessarily a normalization problem (or you're querying a database like this anyway that you don't admin).
Seems like there's a few choices here. Max(blah), max(ha) max(whatver).
Or min(every column). Obviously since they're all the same, it'll return it.
There's also "group by" each of those duplicate columns. Naturally, this can provide different results depending on your assumptions/ certainty that the columns will be duplicated.
Then there's also, in MySQL only (not MS or Oracle) -- putting nada, and it'll just take the first row found.
Which is typically the fastest? I suppose the best way is to test it. Just wondering though.
sql-server performance query
Frequently, I'll need to crunch down a table into a series of aggregates.
And frequently, it will look like this.
John, Smith, Houston, Texas, Order 55, Balloon, 99 dollars
John, Smith, Houston, Texas, Order 55, Bicycle, 400 dollars
In other words, there's the "key column" to group by (order ID in this case).
There's then columns that should be "summed" or "counted" or properly aggregated.
Then there's a bunch of columns that are just duplicated values. This happens a lot and is not necessarily a normalization problem (or you're querying a database like this anyway that you don't admin).
Seems like there's a few choices here. Max(blah), max(ha) max(whatver).
Or min(every column). Obviously since they're all the same, it'll return it.
There's also "group by" each of those duplicate columns. Naturally, this can provide different results depending on your assumptions/ certainty that the columns will be duplicated.
Then there's also, in MySQL only (not MS or Oracle) -- putting nada, and it'll just take the first row found.
Which is typically the fastest? I suppose the best way is to test it. Just wondering though.
sql-server performance query
sql-server performance query
asked 53 secs ago
user45867user45867
6192819
6192819
add a comment |
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "182"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f234501%2ffastest-aggregate-function-when-you-have-series-of-duplicate-values%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Database Administrators Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f234501%2ffastest-aggregate-function-when-you-have-series-of-duplicate-values%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown