« first day (2361 days earlier)      last day (2493 days later) » 

12:03 AM
The issue is, even if I switched it to an INT PK, and made the NVARCHAR(64) PK a non-PK, and kept it, I would still not really gain much (I don't think) because literally every query has a WHERE Name = @Name and that Name is the PK now, and even if I made a new PK as an INT it would still always be WHERE Name = @Name in the query, because I reference all these items by their name, and they're frequently referenced.
 
@sp_BlitzErik I can, but a link to what?
the chat message here?
 
Also, rare inserts. Should have mentioned that. Mostly SELECT, few UPDATE, no DELETE, and rare INSERT.
 
ok, I think I can give a real answer on the subject
looks like for the query in row mode we end up with a repartition streams operator that partitions by the PARTITION BY column
this happens even when the sort isn't needed
so if we're partitioning by a constant value then all of the rows will be assigned to one thread
so having that query go parallel doesn't seem helpful at all
with the batch mode operator we can get distribution over multiple parallel threads, even when partitioning by a constant value
of course, that's not an answer for why it won't go parallel. just that it wouldn't be beneficial to do so
 
12:25 AM
@EBrown If that column is referenced in every query having an index on it makes sense. If the column is a candidate key then defining that index as UNIQUE is the right thing to do. Having it as the clustered index, however, will have implications for all other indexes, as the clustering column(s) are duplicated in non-clustered indexes. So other indexes (if there are any?) will have fewer rows per page, require more pages per scan, have greater depth -- all making reads slightly slower.
 
@MichaelGreen There will not be any other indexes, period. It makes no sense, really, because the table has a low cardinality and few columns.
 
You could have the best of both worlds by hashing Name and using the hash (an integer) as the PK at the small additional cost of calculating the hash each query.
 
I don't know if you're familiar with EF/C#, but I can post the actual object if it helps you.
 
@EBrown only a little bit. Not enough to offer advice.
 
@MichaelGreen I could do that, but these values are literally referenced hundreds of times per page load, by name.
I cannot do them by ID either, even if they had one.
CREATE TABLE [dbo].[Settings](
	[Name] [nvarchar](64) NOT NULL,
	[Value] [nvarchar](max) NULL,
	[Type] [nvarchar](max) NULL,
	[DisplayName] [nvarchar](max) NULL,
	[Description] [nvarchar](max) NULL,
 CONSTRAINT [PK_dbo.Settings] PRIMARY KEY CLUSTERED
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
There's the DDL.
Since you're not an EF person. ;) The MAX size qualifiers on each NVARCHAR will eventually be replaced with hard values, but that should tell you what's going on.
Literally the only column that's not requested by every query is Description, which is only used to inform editors of the value what it is all about.
Everything else is almost always needed, DisplayName is also less frequently used but much more-so than Description.
Basically, the C# API is viewed like: var smtpServer = DefaultSettings.SmtpServer.GetValue(context);, which will query the DB for Name, Value, Type where Name = 'SmtpServer', then return Value formatted to Type, depending on what system type it is.
 
12:37 AM
With a single pathway in to the data (Name = @Name), no other indexes, no referencing FKs, no secondary indexes, column is unique and not nullable .. can't think of a good reason not to define it as a PK.
 
Alright, I appreciate your input. :) I wanted to make sure this was not going to become a major problem in the future, and, as I said, cardinality should be low - I currently have 20 whole records in this table, and I expect it to grow no larger than 200-300, eventually I'm going to add an INT which is an FK to a different table but that shouldn't be pulled except on a few queries with Description - that's when it'll most likely be needed.
 
1:04 AM
In the future, when you add that new column and make it a FK referencing a different table, you'll likely put an index on that new column. If you make Name the clustering column, that new index on the new column will be a little bit larger because, under the covers, it will drag in Name, too, since Name is the clustering column. With the number of rows you mention the difference will be tiny and not worth worrying about.
 
@MichaelGreen Yeah, I'm not worried about the very small space taken. (Over 1k rows the max extra consumption is 25kB, which is negligible.) What I did just realize is I do have a table that FK's this one, I totally forgot because it's a history-log, and I don't count it. (Since I never query it, really.) I'm starting to think I might want to ID this table with an INT and index Id, Name, Value, Type, since those will be pulled most frequently. I'm still not sure yet.
 
 
6 hours later…
6:56 AM
Morning
 
morning
 
Morning
 
oh boy, a guy complaining at Postgres mailing list that "nothing ever works", referring to Postgres docs ...
I guess he was used to the amazing msdn documentation
 
Is it my browser or you get this red blocks too on dbfiddle.uk?
 
7:16 AM
Tere hommikust (Estonian)
 
@ypercubeᵀᴹ a link maybe?
 
7:56 AM
@McNets Please feel free to take from my answer and add to your's. dba.stackexchange.com/q/176961/15356
 
morning
 
@AndyK why?
 
why about @dezso?
 
8:12 AM
@AndyK hating RDS
the small arrow on the left handily brings you to the post it is an answer to
 
@dezso actually, it is not really handy to use
My company wanted to use a centralized database hosted in the Frankfurt datacenter. However, when we did tests from China, there are latencies issues
5 mn to connect and even more time to retrieve data, around 10mn
Probably due to great firewall
the rest of the world have decent reactions time
so I thought about creating a second database in Korea, which is closer to the factories in China and setting up some form of bidirectional replication
 
@hot2use no problem
 
but so far no luck
 
@dezso your profile pic is not visible
 
8:47 AM
Seen on the interwebs today - American Gothic, Hunter S. Thompson style.
 
9:01 AM
@McNets isn't it? I see it
@AndyK well, it is, just ask anyone else around
 
@dezso Ok, now I see it too
 
@dezso not in my case
I recon RDS is handy to set
but once you are facing some architecture 'connundrum', there are limits to it
 
0
Q: Latency issues when inserting content to China

Andy KBackground We have an app that will write into a postgres db hosted in Frankfurt datacenter. The app is installed in each of the 8 sites we have around the world, from China, Korea, India , Germany, France and Mexico. When connecting in Europe, to the Frankfurt database, the response times a...

 
9:20 AM
1
Q: Latency issues when inserting content to China

Andy KBackground We have an app that will write into a postgres db hosted in Frankfurt datacenter. The app is installed in each of the 8 sites we have around the world, from China, Korea, India , Germany, France and Mexico. When connecting in Europe, to the Frankfurt database, the response times a...

 
@ypercubeᵀᴹ that guy is a beginner, that's no problem. But he is a noob, too. And maybe a knob.
@AndyK that seems to be a better choice
 
@dezso He supposedly has experience in SQL Server. If he is a beginner, starting with pgplsql and dynamic SQL is not the best strategy in my opinion.
 
@ypercubeᵀᴹ he might be that cursor type
and dynamic SQL should be the last resort, but many people with some procedural programming background seem to be in love with it
 
Thanks Dezso
 
10:19 AM
Do recruiters and employers live in some sort of dreamland?
40k for a production DBA job in London. Candidate needs 8 years experience. Good luck with that!
 
@hot2use FYI
Why can't I paste a comment as is?
 
@McNets I think because it has been deleted
 
@ypercubeᵀᴹ yes, sorry. I haven't noticed until I reload the question
 
10:58 AM
Did I comment?
I missed it. Dang.
 
@hot2use another user has posted a comment about an undocumented msdn function to read agent dates
 
Ah ok. Thanks.
 
like msdn.dbo.agent_date (not sure)
msdn.dbo.agent_datetime(date int, time int)
 
@McNets Cool. Thanks.
 
11:24 AM
1 message moved to Trash
@McNets Before @PaulWhite notices ^^
 
11:35 AM
@TomV a post worthy of the site's reputation ;)
 
11:46 AM
and a move worthy of this chatroom's
2
 
12:02 PM
Am I reading this correctly that a certain person is frowned upon in the community?
 
Not sure what to do here, a customer is migrating from Oracle to SQL Server and they are running some tests.
They are suffering a lot of blocking "We didn't have this happen in oracle"
The application code is way beyond fixing, and most of the blocking happens after locks escalate
 
@TomV Could this be for a Windchill product?
 
I could disable lock escalation for one table at a time and then end up disabling it on almost every table, or i could disable it globally to make SQL Server "behave" like Oracle
I'm not fond of either approach actually
 
@TomV I guess whoever advised the migration did not informed them they might have many kinds of issues.
 
@TomV Were there any LOCK HINTS FOR UPDATE on SELECT statements when you caught trace data?
 
12:10 PM
@hot2use with "community" you mean this chatroom?
 
@ypercubeᵀᴹ yes
 
Well, I'd say no. Not the person.
 
Ok.
 
The quality of the blog, yes.
 
:-)
 
12:12 PM
@Philᵀᴹ The employers do often enough, although it could easily have been advertised just to tick a box in a process where they really want to promote someone internally.
 
I saw 40K for a SQL (Server) developer in Malta today.
I think 40K euros in Malta is much better than 40K pounds in London ;)
3
 
@ypercubeᵀᴹ Pretty sure it is. Ask @gbn what he thinks of it.
Offtopic - I wish Smalltalk development was still a thing.
 
@TomV Someday, you should teach me with the un-written rules.
 
12:28 PM
@ypercubeᵀᴹ Multinationals and their office politics... :(
They also don't realize this stuff needs thorough testing
They expect me to be on call/on site the week after the migration "in case there are any issues"
 
@TomV is it only the database being migrated? Not the application code as well?
 
I'll be one of the busiest weeks of my life
@ypercubeᵀᴹ in AX there is some form of kernel that translates application queries into RDBMS specific queries
Which makes them think nothing needs to actually change and their application is "portable"
They think years of off-shore development and a terabyte database can just be transferred to another RDBMS like that
 
Joke otD:
As neither of them is valid SQL, both will result in an error. So yes, they are equivalent in terms of performance — a_horse_with_no_name 12 mins ago
3
 
It'll be more Porta Potty than Portable
@hot2use No hints and not WindChill
 
12:48 PM
Otherwise, when you manage to make the queries work, you can use EXPLAIN ANALYZE to see if they produce the same plan and same execution times. Also, the PostgreSQL optimizer is very good at doing its job, so I wouldn't start worrying about performance at this stage yet. — dezso 13 mins ago
I'd start worrying about some other things first.
 
@hot2use Like the fact that you're using PostgreSQL?
 
1:01 PM
@hot2use exactly what I meant by 'at this stage yet'. Get your SQL right first, for example.
@EBrown well, let's be honest: that's the only sane part of that question
 
what a parentheses can do.
1
A: How to create an index on CASE expression in Postgres

ypercubeᵀᴹTry adding extra parentheses around the CASE expression: CREATE UNIQUE INDEX test_index ON test ((CASE WHEN i=1 THEN j END)) ; As the docs state in CREATE INDEX: The key field(s) for the index are specified as column names, or alternatively as expressions written in parentheses.

 
 
2 hours later…
3:29 PM
see ya
 
 
2 hours later…
5:36 PM
@McNets you around?
Or perhaps anyone who has used dbfiddle.
Is there a way to copy paste an execution plan? (or do I have to print screen and edit in my machine?)
When I try the markdown, the result is too big to be put in an answer.
 
@ypercubeᵀᴹ How are you generating the execution plan? Locally in SSMS or through dbfiddle?
 
@JoeObbish in dbfiddle
 
hmm
with the right permissions you can get the XML of the estimated plan through sql server
and could copy and paste that into paste the plan
do you need the actual plan?
 
@JoeObbish No, don't worry.
I'll print screen and paste the image
Whoever wants to, and go to dbfiddle and see the details
 
yeah, that seems reasonable enough
 
5:57 PM
@ypercubeᵀᴹ I think you can copy and paste execution plan but not using last versions of SSMS, let me see
Microsoft SQL Server 2005 XML Showplan
 
@McNets I was only trying to copy-paste from dbfiddle.
and thnx for the edit @Colin'tHart
 
@ypercubeᵀᴹ (Y)
I've been bitten by that same "problem" several times.
 
@ypercubeᵀᴹ Could you paste the link?
 
@ypercubeᵀᴹ You could use paste the plan brentozar.com/pastetheplan/?id=rJVhDYtQW
 
6:10 PM
@McNets thnx
 
@ypercubeᵀᴹ It seems a Piccinelli question.
 
@McNets that sounded like a Fermat conjecture ;)
 
haha
 
6:40 PM
0
Q: Rewrite an Answered Question?

John EisbrenerSo I just asked the following question based on an incorrect assumption: Temp Table Clustered Key Not Being Honored: Bug or Expected Functionality? Martin Smith provided a great answer on why I was seeing my behavior, but his answer was to the eventual follow-up question I asked after some back...

 
 
5 hours later…
11:44 PM
@sp_BlitzErik Was that what you were looking for on the parallelism question?
 

« first day (2361 days earlier)      last day (2493 days later) »