I am investigating on the Sql Server behaviour with the “Optimize for Ad hoc Workloads” option set to “True”; in particular, I am trying to understand which information we have in cache after the first execution of an Ad Hoc query and consequently the Stub is put in cache.
I noticed that as soon ...
That seems like a good question to me, well above average in fact. I wonder why someone would choose to downvote it. Perhaps the interactions between cache DMVs and parameterization are super-obvious.
@ErikDarling Because you could only find the duplicate if you already knew the answer. It's a duplicate answer rather than an exactly duplicate question. Some thinking is also required to understand how the linked answer resolves the question. Had the author responded by saying they didn't understand, I would have explained in a full answer with a link to the 'dupe'. As it is, they knew enough to work it out for themselves.
@ErikDarling On a first read, I even thought they might be saying they'd seen 'query stats' DMV rows were being removed because the parent cached plan did not contain a query plan (only a stub). That would have been an interesting (though unlikely) bug.
I need an advice.
I would need to trace one particular procedure in SQL Server. It happens to me that one procedure ends up with a timeout and I need to find out which select, insert or update this happens. I want to ask, I don't know much about SQL profiler, so my question is, is it really the b...
I have a Sql Server database which currently has 270 gigs of space allocated to it.
However, the actual space used is 27% (81 gigs).
I would like to reclaim that space, as on Azure, they charge you by the amount of allocated space. The large amount of unused space is due to dropping a varbinary ...
> DBCC SHRINKDATABASE operations can be stopped at any point in the process, and any completed work is kept.
> DBCC CLEANTABLE runs as one or more transactions. If a batch size isn't specified, the command processes the whole table in one transaction, and the table is exclusively locked during the operation. For some large tables, the length of the single transaction and the log space required may be too much. If a batch size is specified, the command runs in a series of transactions, each including the specified number of rows.
Chekhov's gun (Chekhov's rifle; Russian: Чеховское ружьё) is a narrative principle that states that every element in a story must be necessary, and irrelevant elements should be removed. For example, if a writer features a gun in a story, there must be a reason for it, such as it being fired sometime later in the plot. All elements must eventually come into play at some point in the story. Some authors, such as Hemingway, do not agree with this principle.
The principle is recorded in letters by Anton Chekhov several times, with some variation; it was advice for young playwrights.
== Criticism... ==
I misread the question at least twice so I'm not really going to go all-in on this
@ErikDarling That's why I said it reminded me of Jay Dee. He went through a bit of a phase (like many others) of commenting, "Would <answer> work for you?"
It's not a brilliantly-worded question, but it is a decent one, once understood
OP could have helped with expected results and mentioning why ALTER COLUMN wasn't an option
I wonder how many non-numeric values there are in that string column
how much space in bytes would DECIMAL(9,6) use compared with DECIMAL(8,6) - I have 60 billion rows so want to estimate the space saving between these 2 (and other types) — QuadeMar 14 at 14:58
@PaulWhite eh, I still think if you're not actually putting the answer in the comments, and just asking if a certain type of answer would solve their problem, should be acceptable. But yes, I'm out of that phase and onto my next one, so I digress.
Imagine this scenario. You have a multi-tenant application, and all the tenants share a database. There's a dbo.Tenant table, and basically all other tables in the DB have a TenantId column with a FK back to that Tenant table. Question for the room: would you consider that relationship to be a hierarchy (Tenant is a "parent" to all of the other tables), or is Tenant simply an attribute of the other tables?
Handling a modest number of customers (tenants) in a common server with separate databases for each tenant's instance of the application is relatively straightforward and is normally the correct way to do this. Currently I am looking at the architecture for an application where each tenant has t...
Given the use case:
Tenant data should not cross talk, one tenant does not need another
tenant's data.
Each tenant could potentially have large historical data volume.
SQL Server is hosted in AWS EC2 instance.
Each tenant is geographically distant.
There is an intention to use third party vis...
Design a shared-everything system. This can be deployed in a shared-nothing way i.e. put each tenant in their own database, should that prove desirable. The extra development effort to type the additional predicate is very small and easy to do up front. The reverse - where you re-factor a shar...
One of my coworkers keeps talking about the concept hierarchically, and it seems to affect the way he models other things in the system (in a negative way in my opinion).
I'm trying to remember the example that prompted me to ask the question...
I think the hierarchy view mostly results in weird application-side modeling. Like, you have a Tenant object, with a List<Employee> and a List<RetailLocation> etc. Everything has to pass through the Tenant object.
But because we're using EF, bad application modeling usually reflects back into janky database tables.
You end up needing to load some huge object graph just to get one thing.
Is that a limitation of the tool though? I would imagine a code thread/session would be dealing with a single tenant for its lifetime. It wouldn't change once determined at the start?
> What the voivode is allowed to do, it is not you stink What is allowed voivode Definition Some people, especially the elderly, the more important, and higher-up, have special privileges and can afford behavior that others consider reprehensible
chatgpt is even better: A possible translation of the Polish proverb "Co wolno wojewodzie, to nie tobie, smrodzie" to English would be: "What is allowed for the noble is not allowed for you, peasant."
== English ==
=== Phrase ===
RHIP
(military, Internet) Initialism of "rank has its privilege" or "rank hath its privileges".
Initialism of rest here in peace.
==== Related terms ====
RIP
=== Anagrams ===
IRHP
I kind of agree though, that it's become a normal word with inherent meaning rather than an acronym. I've met multiple people that know the word but aren't familiar with the acronym origin.
@PaulWhite You're right that, for a given thread / session, the tenant won't change. In this case we're talking about web apps, and a thread is associated with a single HTTP request.
We might be pulling a list of employees that work at a particular store to display in a grid, via a HTTP GET request to a route like /api/{ORG_ID}/{STORE_ID}/employees.
In the code for that route, I don't really want to get the org, then get the store, then get the employees. I just want to say something like return _context.StoreEmployees.Where(e => e.Store.Id == STORE_ID && e.Organization.Id == ORG_ID);
WITH web_users AS (
SELECT
tracks.anonymous_id,
tracks.user_id,
lower(COALESCE(tracks.context_campaign_source, tracks.context_campaign_m_source, tracks.context_campaign_tm_source, tracks.context_campaign_ntutm_source, tracks.context_campaign_utm_source)) AS source,
lower(COALESCE(tracks.context_c...
@ErikDarling no but pg mat views don't stay in sync with the data. They're snapshots
@JoshDarnell I see. Thanks for the example. I can't help but think back to days when we'd implement that as a stored procedure with parameters for the organisation and store keys
Which I know is an obvious point and doesn't help with the EF and design issue you're talking about.