New answers tagged

2

How many rows are being aggregated on each SELECT? This should go without saying - ensure you have an index on the datetime column. Depending on what your query is doing you can also try putting a compound index on your datetime and the column you're aggregating to try to only use the index and avoid reading data blocks off the disk. Please post an ...


4

There are three parts to this Question, so let's start with the "Block on Data Loss" option, dropped Tables, and then dropped Columns. "Block on Potential Data Loss" Option If you enable the "Block incremental deployment if data loss might occur" option: on the "Debug" tab of "Project Properties" using the /p:BlockOnPossibleDataLoss=True command-line ...


0

First try DROP SCHEMA schema_name If the schema contains objects, the DROP statement fails. Why? I was trying to transfer a scheme that existed on a user account that came over when a database moved. I needed to delete the user but was getting hung-up on the schema that came with it. The schema matched the user name. I tried the solution at this ...


0

The problem was that every now and then an unrelated query put a lot of stress on the server and was causing the threads running to nearly max out. It was doing this regularly before the schema change was first run.


-1

Just think of of this: The child table owner schema begins to create record in its table and unknowingly prevents the parent table schema user from deleting records from the parent table. Is it something it anticipates and appreciates?


6

As already cited by others in comments, adding NOT NULL to your table specification can improve in a significant way the performances of your queries (in addition to the very good methodological reasons stated in another answer). The reason is that the query optimizer, knowing that a column cannot have a NULL value, can exclude special tests for such values,...


8

What happens when a new programmer arrives and has to write an app against that db? They don't know that field x has to be NOT NULL. Another programme might assume that all field x's are NOT NULL for performing counts say, but some now are NULL because of the new programme, leading to inconsistent and difficult to trace errors. IMHO it is always best to ...


2

You could create a view that looks like something like this: create view test_view as select a,b,c,d, case when a = greatest(a,b,c,d) then 'a' when b = greatest(a,b,c,d) then 'b' when c = greatest(a,b,c,d) then 'c' when d = greatest(a,b,c,d) then 'd' end from test; Note that the above will not ...



Top 50 recent answers are included