dialog
listlengths
4
30
title
stringlengths
15
150
category
stringclasses
14 values
dialog_time
stringdate
2016-01-21 01:59:30
2018-07-01 01:34:46
[ { "message": "It's possible to simulate a loop in SQL Server with a self-referencing CTE and a union all, something like the following:<pre><code>declare @a int = 1;declare @b int = 5;;with Tbl as ( select @a a UNION ALL select (a + 1) a from Tbl where (a + 1) &lt; @b)select * from Tbl</code></pr...
Is there a UNION ALL equivalent for columns?
dba
2017-12-29T14:59:47.783
[ { "message": "I have a case where I <code>SELECT</code> rows from one table and <code>INSERT</code> them to another table. However, I get <code>Error: 1329 SQLSTATE: 02000</code> if the <code>SELECT</code> statement doesn't return any row. Can I do something like:<pre><code>CREATE PROCEDURE SP() DECLARE CONTI...
How to skip to next iteration if no results are returned in SELECT statement in Stored Procedure
dba
2017-12-29T15:28:00.823
[ { "message": "I have a chats collection which given down below<pre><code>{ \"_id\" : ObjectId(\"5a44e6545818041cde24aac9\"), \"messages\" : [ { \"createdAt\" : ISODate(\"2017-12-23T07:46:29.201Z\"), \"message\" : \"Hii\", \"userId\" : \"000000\" }, {...
Get limited data from $unwind mongodb
dba
2017-12-30T17:17:36.340
[ { "message": "I have a table in mySQL to store product attributes like this:<pre><code>------------------------------------| product_id | att_val1 | att_val2 |------------------------------------| 1001001 | x202 | 2200 || 1001002 | t100 | 180000 || 1001003 | T100 | 1080 || 1001001...
Query to find products with all the given attributes
dba
2017-12-31T17:55:40.317
[ { "message": "I'm out of ideas, so I'm asking for your help.I have a weird problem which I cannot find a cause for no matter how much I search on the internet.Thing is, I have two laptops:l1 : HDD and a Kingston HyperX Fury SATA-III SSD (240G)l2 : HDD and a Samsung 960 evo, nvme SSD (500G)And I have a procedure...
Sql server ssd slow performance
dba
2018-01-01T15:27:24.207
[ { "message": "The title says it all. In Oracle, we can easily get the OS user using:<pre><code>select sys_context( 'userenv', 'os_user' ) from dual; </code></pre>I usually use that for logging purposes (know who inserted/updated what and when). I searched for something similar for Postgres (I am new to it) but ...
How to get OS user in Postgres?
dba
2018-01-02T06:46:14.093
[ { "message": "I have a PostgreSQL table with the following structure:<a href=\"https://i.stack.imgur.com/MOrYS.png\" rel=\"nofollow noreferrer\">I simply need to change the <code>TYPE</code> of <code>prove_identity_id</code> from <code>bigint</code> to <code>bigserial</code>. I read the <a href=\"https://www.p...
How can I change an existing type from "bigint" to "bigserial"?
dba
2018-01-02T15:02:21.340
[ { "message": "We have a large database. We want to remove previous months data from Prod DB and keep only 3 months data. We also want a Report DB with all data. For Example: we have restored complete Prod DB backup on Report DB on 01-JAN-2018 00:00:00 on a separate server. Now on 1st of each month we want to re...
How to maintain production database with less data and report database with all data
dba
2018-01-02T16:14:46.423
[ { "message": "I have a test VM instance with SQL Server installed on it. It is not part of a domain, just a workgroup.I want to use Integration Services, which I understand requires SSMS to log in using Windows Authentication.Is it true that I have to use Windows Authentication to access SSIS?If not, how can I ...
SSMS connect via windows authentication when the server is not part of a domain
dba
2018-01-02T19:04:32.930
[ { "message": "I have two tables structured like so:<pre><code>Table1 (reference table)| Name UNIQUE | Value(Double) |Table2 (data table)| Name1 | Name2 | Number(Int) |</code></pre>I want to add 10 to the number in each row of Table2 where the value of Name1 (from Table1) is greater than the value of Name2 (from...
Update table based on reference values from another table
dba
2018-01-02T19:30:47.613
[ { "message": "Approach_1Through SQL query<pre><code>Select * from employee where id = 100</code></pre>Approach_2 Here is the db view(employee_view)<pre><code>Select * from employee</code></pre>Then use the DB view in sql query from java <pre><code>select * from employee_view where id = 100</code></pre>My under...
Fetch data from view vs query?
dba
2018-01-03T12:36:14.787
[ { "message": "I'm trying to come up with a database script that will be used to migrate an earlier version of an application database to a later version. The differences are quite extensive, and accomplishing the migration will involve creating new tables, renaming tables, adding functions, adding views that ha...
Multiple Batches in SQL Server Migration Script
dba
2018-01-03T17:04:59.997
[ { "message": "I'm planning to set up a new SQL Server 2017 Standard Edition instance, with Basic Availability Groups. How can I test that in a dev or qa environment?In my QA environment now, I have Developer edition installed. When I run the T-SQL to create a Basic Availability Group, I get the following error:...
How to test SQL Server Standard Basic Availability Group?
dba
2018-01-03T17:51:53.763
[ { "message": "I want to store a whole HTTP response in PostgreSQL database row.I need the HTTP status, the headers and the body.AFAIK there is no native data type for this.How could I store a HTTP response?UpdateI have been thinking about this again. I guess it is best if I follow this pattern: I won't search a...
Store HTTP response in PostgreSQL
dba
2018-01-03T21:02:30.770
[ { "message": "SetupI have a bulk insert function <code>set_interactions(arg_rows text)</code> that looks like this:<pre><code>with inserts as ( insert into interaction ( thing_id, associate_id, created_time) select t-&gt;&gt;'thing_id', t-&gt;&gt;'associate_id', now() from json_array_elem...
Deadlock with multi-row INSERTs despite ON CONFLICT DO NOTHING
dba
2018-01-05T19:42:47.383
[ { "message": "I have a table called Players and columns Name, PlayerID. I am using sqlite under DB Browser for SQLite.Unfortunately, all my player's names have a something like a \"\\n\" (turned out to be a /r) at the end of the name.Ex:<pre><code>\"Mark\"</code></pre>I tried to Update &amp; Replace all the nam...
Replace & Update all rows sqlite
dba
2018-01-06T16:40:35.857
[ { "message": "I'm looking at the PostgreSQL docs where:<blockquote> REFRESH MATERIALIZED VIEW completely replaces the contents of a materialized view. The old contents are discarded. </blockquote>However, since 9.5 I believe, there is a way to update a MV without having to regenerate all the data.", "role"...
How to do an incremental refresh of a PostgreSQL Materialized View?
dba
2018-01-08T16:13:50.853
[ { "message": "We are on MYSQL 5.7 and when we create a column like so in our DDL<pre><code>my_update_timestamp timestamp(6) NOT NULL</code></pre>MySQL complains when we try to create the table with<pre><code>Error 1067: Invalid default value for my_update_timestamp.</code></pre>Is it possible to have a not nul...
MySQL Timestamp and NOT NULL
dba
2018-01-09T10:09:01.457
[ { "message": "Recently, I had an issue with one of my database which got XID wraparound issue. So, I have started with <code>single-user</code> mode and ran <code>vacuum</code>. Everything was fine. But, when I checked <code>datfrozenxid</code> its ~1.5billon where as my <code>txid_current</code> is ~70billon. ...
XID wraparound metrics are unclear
dba
2018-01-09T10:55:23.380
[ { "message": "I have an application which is getting data from Oracle(11.2.0.4) Materialized view, there is expected behaviour about materialized view will go INVALID whenany DML action happens on the associated tables or assocaited objects are invalid.My materialized view opotions are as listed below and confi...
Materialized view became INVALID and USER_MVIEWS.COMPILE_STATE becomes 'NEEDS_COMPILE'
dba
2018-01-09T11:27:06.393
[ { "message": "I have an application which is getting data from Oracle(11.2.0.4) Materialized view, there is expected behaviour about materialized view will go INVALID whenany DML action happens on the associated tables or assocaited objects are invalid.My materialized view opotions are as listed below and confi...
Materialized view became INVALID and USER_MVIEWS.COMPILE_STATE becomes 'NEEDS_COMPILE'
dba
2018-01-09T11:27:06.393
[ { "message": "I'm having problem ( I have problems with cursor since ever and I really need to understand how the hell it works ).I would like to run this command in all databases:<pre><code>SELECT db_name() as Dtabase_name,dbtables.[name] as 'Table',dbindexes.[name] as 'Index',indexstats.avg_fragmentation_in_...
implement this query inside a cursor
dba
2018-01-09T18:55:37.280
[ { "message": "Is it possible to determine what user created another user's account in Oracle database?I have two types of users in database:Users having system and object privilegesUsers having only system privilegesI can find the owner of all users having system and object privileges.<pre><code>select distinct...
Oracle user created information
dba
2018-01-10T12:28:12.207
[ { "message": "If I declare a column to be <code>serial</code> in PostgreSql, it will auto-increment in a ordinal sequence. The end result may not be contigious due to rollbacks and whatnot, but it's more or less ordinal.I have a user table where the user id's are set as <code>serial</code>, and are thus increm...
Make a non-ordinal numeric ID in PostgreSQL
dba
2018-01-10T19:08:25.090
[ { "message": "If I declare a column to be <code>serial</code> in PostgreSql, it will auto-increment in a ordinal sequence. The end result may not be contigious due to rollbacks and whatnot, but it's more or less ordinal.I have a user table where the user id's are set as <code>serial</code>, and are thus increm...
Make a non-ordinal numeric ID in PostgreSQL
dba
2018-01-10T19:08:25.090
[ { "message": "All,I would like to know what path should I chose in order to achieve MCSE for SQL 2016. I already completed MCSA certification for SQL 2012/2014 and would like to upgrade it to MCSE SQL 2016/2017. Kindly, let me know what is the best approach for this. Is there any direct path or do I need to tak...
Upgrade certification from MCSA sql server 2012/2014 to MCSE SQL 2016
dba
2018-01-11T01:04:02.817
[ { "message": "In some scenarios like <a href=\"https://stackoverflow.com/questions/48043635/sql-server-user-defined-function-to-calculate-age-bracket/48043653#48043653\">this one, SQL Server will silently truncate (N)VARCHAR values leading to serious data loss when incorrectly declaring variables.Question: Can ...
Can SQL Server be configured to not silently truncate VARCHAR values?
dba
2018-01-11T09:28:39.260
[ { "message": "I'm a bit confused by terms latency and throughput in case of databases. My understanding is that latency represents time needed to perform a single request (e.g. insert or select), while the throughput represents the number of such operations during a certain amount of time (e.g. how many inserts...
Database latency vs throughput
dba
2018-01-11T09:53:00.667
[ { "message": "I need help with a database design for an ACL (Access Control List) system.Business rulesLet me explain the requirements:Any business object in the system will get an ACL that explicitelly defines who can access the object. Our system has groups of users and the ACL will specify which groups can a...
Need help designing an Access Control List (ACL) database structure
dba
2018-01-11T11:48:01.773
[ { "message": "My production environment uses MS DTC and SQL Server 2014. I must have an HA solution such as Mirroring or AG in place. (Not FCI). I am trying to explain to my team that MS DTC is not supported by SQL Server with Mirroring / AG and what could go wrong. But all the examples I am seeing online are f...
Implementing HA for SQL Server for a .NET Application that uses MS DTC
dba
2018-01-11T15:56:19.527
[ { "message": "We have a SQL Server database which has a database audit specification which audits all execute actions on the database.<pre><code>CREATE DATABASE AUDIT SPECIFICATION [dbAudit]FOR SERVER AUDIT [servAudit]ADD (EXECUTE ON DATABASE::[DatabaseName] BY [public])</code></pre>We've found that some querie...
How to filter out Scalar Valued User-Defined Function usage from SQL Server Audit Data?
dba
2018-01-11T18:24:24.117
[ { "message": "I'm using <code>SQL Developer Data Modeler</code> in a oracle server. No problem, I can connect to SQL Server, list tables and generate a really good report. But what I need is to extract the <code>extended properties</code> from tables and columns. I'm looking all over the internet but what I fo...
It is possible to extract Extented Properties using SQL Developer Data Modeler?
dba
2018-01-12T14:31:49.387
[ { "message": "Using SQL Server 2008R2, I am trying to pull the latest assessment date for a patient. I have it pulling the correct data I need, but it is pulling all dates. For instance if a patient has an assessment on 1/1, 1/5, 1/8, and 1/10 I am currently getting all records when I really only want the last ...
Retrieve Latest (max) date
dba
2018-01-12T15:29:56.263
[ { "message": "The below is from <a href=\"https://rads.stackoverflow.com/amzn/click/0133970779\" rel=\"nofollow noreferrer\">Fundamentals of Database Systems (7th Edition)<blockquote> 17.1 Types of Single-Level Ordered Indexes There are several types of ordered indexes. A primary index is specified on the o...
What is the formal definition of a Primary Index and Primary Key?
dba
2018-01-12T16:48:27.890
[ { "message": "Note: I am relatively new to managing an SQL database. I have done my fair share of reading, research, and experimentation, but it is possible that I am missing some fairly basic knowledge. I'm also not sure how to tag this question so if someone could add relevant tags that would be appreciated.I...
Database Normalization Causing Inefficiency
dba
2018-01-14T07:18:30.253
[ { "message": "I am creating function using pgAdmin4 and the CODE Basically something like <pre><code>BEGIN RETURN QUERY SELECT * FROM teest.\"students\";END</code></pre>I am just wondering, how do I set the TABLE ReturnType as<code>TABLE(applicant_id integer, ship_id integer)</code> something like that. Th...
How to create function with Return Type as (TABLE student_name string)
dba
2018-01-14T10:22:24.080
[ { "message": "I am trying to prepare data for a candle stick chart. I have some records on MySQL database as shown below: <pre><code>| Rate | Date ||----------|---------------------|| 0.001111 | 2017-11-12 19:13:05 || 0.001214 | 2017-11-12 19:14:11 || 0.001612 | 2017-11-12 19:15:42 || 0.00123...
Grouping data into 5 minute intervals within a time range
dba
2018-01-14T11:05:47.177
[ { "message": "Sorry for newbie question.For example, there is some kind of abstract device, we will call the Device class and the tasks for it: Task1, Task2, Task3.For concreteness, I will describe everything in java codes.<pre><code>class Device {long id;String name;int ip;int filed1;String filed2;// and so on...
Correct organization of the database structure and selection
dba
2018-01-14T12:38:31.573
[ { "message": "I have one big source table in which attributes are mixed with measures together. I want to make a bridge table from them to allow analysis of the data.Problem (in my case N is actually 22, id_column reference same table)<pre><code>|id | id_column1 | id_column2 | id_columnN | stuff |+---+--------...
Building an bridge table from existing one with the use of the SELECT INTO
dba
2018-01-14T18:37:53.370
[ { "message": "I have a data sample for products with different prices depending on quantity and attributes. The price might be updated occasionally (not too frequently). <pre><code>PID | Name | Type | Colour | Colour Print | Quantity: 1 to 149 | 150 to 199| 200 to 249 |250 to 4991 |White AB...
Efficient database design for multiple price based on quantity and attribute
dba
2018-01-14T20:05:53.407
[ { "message": "In Postgresql 9.6, is there a clean way to multiply corresponding elements within two equally sized arrays?For example <pre><code>a = [1,2,9,4,5]b = [5,8,4,0,12]function(a, b) would return [5, 16, 36, 0, 60].</code></pre>I'd prefer it as a function like this, since it'd be used in multiple places....
Multiply elements of equally sized postgresql array
dba
2018-01-16T01:52:14.107
[ { "message": "How can I take an existing production Azure SQL database (or one of its regular backups) and restore it to a dev environment on a regular basis? I want to give developers the option to work on their regular dev database but also have a snapshot of prod available in order to safely reproduce issues...
How to move snapshot Azure SQL db from prod to dev on a recurring basis
dba
2018-01-16T02:03:57.630
[ { "message": "I have a dedicated server with 128 GB of RAM and an 8 core CPU and2TB hard drive.I have cPanel and MySQL installed in the same server.In this server I have 12 websites hosted including 5 with a largetraffic, these 5 sites have 60000 visits per day in total.Sites in Wordpress and Drupal and Prestas...
MySQL process takes up to 180% of the CPU (optimisation need)
dba
2018-01-16T07:50:47.763
[ { "message": "We have a question related to a DB query : <pre><code>CREATE TABLE `Action` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `emp_Id` int(10) unsigned NOT NULL, `name` varchar(60) NOT NULL, `updated_action_at` datetime(3) DEFAULT NULL, `created_At` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,...
How to merge records for query set
dba
2018-01-16T09:57:50.900
[ { "message": "have to monitor blocking queries in SQL Server 2012. How do we figure out which queries are the locked ones? Do I use the Activity Monitor? I want actual SQL statements.", "role": "user" }, { "message": "The Microsoft Tiger Team has posted a set of scripts that handle this for you. Che...
Monitoring blocking queries in SQL Server 2012
dba
2018-01-16T18:31:22.913
[ { "message": "I'm drawing up a proposal for upcoming infrastructure changes. This will include a production server and reports/data warehouse server, each with Always On. To keep hardware and licencing costs down, is it possible to run in a configuration of Server-A running Prod-AG Primary and Rep-AG Secondary,...
Can you run two WSFC instances on two servers where each node is the primary for a different availability group?
dba
2018-01-17T12:00:31.933
[ { "message": "Here are the columns of an SQL Table:<pre><code>Course_CodeCourse_NameTutor_IDTutor_NameStudent_NoStudent_NameDateOfBirthGenderLastAttDate</code></pre>By checking all the NF1 requirements below, I believe this table is NF1.<pre><code>All data is atmoicThere is no grouping of columns. Each column c...
Is this table in 1NF?
dba
2018-01-18T14:42:50.187
[ { "message": "I'm trying to define the following table in PostgreSQL:<pre><code>posts- uuid- title- created_at- updated_at- deleted_at</code></pre>The idea is that i never delete anything, so i change the deleted_at instead of removing the row and use <code>where deleted_at is null</code> for normal behavior.Is...
Automating timestamp fields in PostgreSQL
dba
2018-01-19T02:59:18.347
[ { "message": "I have created an empty <code>UNLOGGED</code> table to faster copy a large amount of data (over 1 Billion rows). Loading the data took around 4 hours.Now I want to set the table to <code>LOGGED</code> to make it safe for unexpected shutdowns and crashes. This process takes a long time. In fact it ...
Set PostgreSQL table to LOGGED after data loading
dba
2018-01-19T11:39:54.070
[ { "message": "Given the following table:<pre><code>CREATE TABLE avl_historico ( fecha timestamp with time zone NOT NULL, latitud double precision DEFAULT 0 NOT NULL, longitud double precision DEFAULT 0 NOT NULL, altitud double precision DEFAULT 0 NOT NULL, velocidad double precision DEFAULT 0 NOT...
Optimizing column types for reduced overall database size
dba
2018-01-19T12:36:43.723
[ { "message": "In our production server which is having PostgreSQL 9.1 installed, too heavy archive logs are being generated, approximately 41 GB/day. Heavy updates, deletes and inserts are the cause of this. Can anyone help us to reduce the amount of archive log generation in our production server?", "role"...
To get rid of heavy archive logs in PostgreSQL 9.1
dba
2018-01-22T06:15:44.067
[ { "message": "Lets say I have two queries like<pre><code>select iif(condition, col, null) from tableselect f(col) from table</code></pre>where <code>col</code> is a double-valued column <code>f</code> is a VBA-<code>public function(value as double) as variant</code>. Somewhere later, I alter the format of the r...
Access: Number format for VBA in queries of variant type
dba
2018-01-22T09:09:50.640
[ { "message": "I have an installation of SQL Server 2014 on a server on the LAN and on my PC I have SQL Server Management Studio 2014 for few months already. Out of no where when I open SSMS I get <code>The type initializer for 'system.windows.media.fonts' threw an exception</code>I have no clue of what might ha...
SSMS 2014 Gives an exception when opening the new query window
dba
2018-01-22T13:14:40.273
[ { "message": "I have installed postgresql version 9.3.14 on High Sierra via HomeBrew. Upon trying to access the server via psql, I was being prompted for a password for the user <code>postgres</code>. Using <code>postgres</code> as the password got me into the database, but I was confused, as I have never been ...
ALTER USER postgres PASSWORD null; now has locked me out of psql
dba
2018-01-22T18:16:39.353
[ { "message": "I am trying to run a command that looks like this:<pre><code>Create ASSEMBLY [AssemblyName]AUTHORIZATION [dbo]From ...</code></pre>When this runs, it returns an error message: <code>Could not obtain information about Windows NT group/user 'oldMachineName\\username', error code 0x534</code>.In this...
Authorization dbo maps to a user with an old machine name
dba
2018-01-25T12:20:25.340
[ { "message": "I was trying to shrink a highly fragmented log file that had already grown beyond its default size.Firstly, I switched the database from <code>FULL</code> to <code>SIMPLE</code> recovery mode, then backed to full for log truncation. This worked fine and the logs were truncated successfully.After t...
SQL Server does not shrink log file to target size right after log file grows and differential backup is taken
dba
2018-01-26T00:21:57.863
[ { "message": "<code>SELECT</code> in ISO/IEC-standard SQL prescribes the following syntactical order for the sub-clauses:<pre><code>SELECT projection-expressionsFROM sourcesWHERE predicate-expressionGROUP BY key-expressionHAVING predicate-expressionORDER BY ordering-expressions</code></pre>Whi...
Do any SQL dialects permit the logical sequence of SELECT clauses?
dba
2018-01-26T01:35:21.817
[ { "message": "I am getting a weird error in my mysql database:<pre><code>SELECT * FROM mytable</code></pre>returns:<pre><code>ERROR 1932 (42S02): Table 'mydb.mytable' doesn't exist in engine</code></pre>I can confirm that the tables do indeed exist on local file system and <code>show tables;</code> does indeed ...
Table doesn't exist in engine
dba
2018-01-26T10:56:31.673
[ { "message": "Most of the settings for Query Store are fairlying straight forward. But as best as I can tell the one most likely to cause performance issues (waits) and with the least clear documentation is flush_interval_secondsI have read <a href=\"https://www.sqlskills.com/blogs/erin/sql-server-query-store-...
What to consider when setting flush_interval_seconds in SQL Query Store?
dba
2018-01-26T18:33:02.280
[ { "message": "I have Two Instance of Node JS server which is handled By NGINX. First server is connect with MongoDB First Server i.e <blockquote> mongoose.connect('mongodb://127.0.0.1/db_primary', { useMongoClient: true });</blockquote>While Second Node Js Server is Connect with MongoDB Second Serer i.e <block...
Copy Specific Columns from DB 1 To DB 2 on MongoDB
dba
2018-01-29T06:54:59.630
[ { "message": "I have Two Instance of Node JS server which is handled By NGINX. First server is connect with MongoDB First Server i.e <blockquote> mongoose.connect('mongodb://127.0.0.1/db_primary', { useMongoClient: true });</blockquote>While Second Node Js Server is Connect with MongoDB Second Serer i.e <block...
Copy Specific Columns from DB 1 To DB 2 on MongoDB
dba
2018-01-29T06:54:59.630
[ { "message": "This is hard to explain but I'll do my best. So to make it simple, I have 3 tables with the following format: Creator table<pre><code>id | name 1 | jack 2 | doge 3 | cardano</code></pre>roads<pre><code>id | creator_id | length 1 | 1 | 3 2 | 1 | 2 3 | 3 | 9 4 | ...
How to have row values as column headers with the associated values in postgresql?
dba
2018-01-29T14:16:27.313
[ { "message": "Since my English are not perfect I will try explaining with an exampleI have tableA that I want to update the Amount <pre><code>groupID reservationID Date Amount26 1 2018-06-01 NULL26 2 2018-06-01 NULL26 3 2018-06-01 NULL27 4 ...
Update a dynamic number of rows with an amount proportionally
dba
2018-01-30T10:34:33.767
[ { "message": "I'm reviewing the error logs for an instance of SQL Server 2012 and found the following error in the log (error 669):<pre><code>The row object is inconsistent. please rerun the query</code></pre>I googled and the only answers seem to be generic listings of sys.messages showing the error number and...
Unusual error message - sql server the row object is inconsistent. please rerun the query
dba
2018-01-30T11:52:08.810
[ { "message": "I have a Sql Server that runs stored procedures slowly sometimes. I’d assume it was a problem with the contents of the stored procedures, but sometimes it’s slow to update stored procedures.Where does one start?", "role": "user" }, { "message": "I've run into this several times: new se...
How to trouble shoot intermittently slow SQL Server
dba
2018-01-30T21:41:47.207
[ { "message": "Running on AWS ubuntu 16.04 and the primary is a local ubuntu 16.04 on local vm.When watching the log, I noticed that the primary will switch to secondary whenever a secondary comes online to let the secondary sync, then it will switch back to primary.is there a way to stop that? This seems worris...
Replica Set Question - one primary instance with two secondary instances
dba
2018-01-30T23:37:42.280
[ { "message": "I know that I can query the \"dba_users_with_defpwd\" table, but I've seen reports that for some accounts (mainly SYS and SYSTEM) even if you provide a new non-trivial password during install, they will be shown as having the default password.Is there any way to verify the users with default passo...
How to determine if users have the default password in Oracle 12c?
dba
2018-01-31T13:21:51.253
[ { "message": "I am experiencing some odd error messages on SQL Server 2017 CU3. I am migrating databases and reorganising filegroups. By \"reorganising\" I mean that I use a <a href=\"http://sql10.blogspot.de/2013/07/easily-move-sql-tables-between.html\" rel=\"nofollow noreferrer\">stored procedure which create...
Cannot remove filegroup with no files associated
dba
2018-01-31T13:33:49.703
[ { "message": "We are considering RabbitMQ for queuing several thousand tasks per minute and then processing them from 300+ virtual machines. We have a smart scheduling web API that will intelligently (fairly) distribute tasks from 100+ queues to the VMs based on business needs. We know that RabbitMQ is definite...
SQL Server Service Broker vs. RabbitMQ
dba
2018-01-31T21:57:28.003
[ { "message": "Following new attribute to the Showplan XML schema SQL Server 2014 or 2016 was introduced by <a href=\"https://support.microsoft.com/en-us/help/3170112/update-to-expose-maximum-memory-enabled-for-a-single-query-in-showplan\" rel=\"nofollow noreferrer\">KB3170112.<blockquote> MaxQueryMemory under ...
Difference between 'GrantedMemory' and 'MaxQueryMemory' attributes in Showplan XML
dba
2018-02-01T03:28:49.823
[ { "message": "I have this query written in Microsoft Access, but I need to convert it to run on SQL Server. I read multiple answers on dynamic pivoting in SQL Server, but can not apply it to my particular code, since I don't know how to pivot multiple conditions that are concatenated in one header.Here is the ...
Pivot functionwith multiple conditions (concatenated in one header)
dba
2018-02-01T13:51:14.377
[ { "message": "We are trying to automate the mirroring set up for multiple databases whose mirror is already in RESTORING state as the set up was part of log shippingSo when we switch from log shipping to mirror I am unable to find a way using TSQL or Powershell to set this mirroring between Primary and Secondar...
Configure database mirroring for multiple databases via TSQL or Powershell when mirror is already restoring
dba
2018-02-02T16:17:24.997
[ { "message": "I am using MySQL 5.6 and have an append-only \"lookup\" table that's used to store reference data:<pre><code>CREATE TABLE my_table ( id INT UNSIGNED NOT NULL AUTO_INCREMENT, my_column VARCHAR(32) NOT NULL, PRIMARY KEY (id), UNIQUE KEY my_column_uk (my_column)) ENGINE=INNODB DEFAULT CHARSET=utf...
How to coordinate two sessions writing the same row to a MySQL table
dba
2018-02-02T21:39:10.777
[ { "message": "I have a table named my_jobs that I am trying to copy a column named \"location\" into two other columns called \"city\" and \"state.\" The city and state data need to be extracted in their own respective columns. The city and state columns are already created. The \"location\" column has multiple...
MYSQL: Merge data from one column to another
dba
2018-02-02T22:49:49.343
[ { "message": "I have a table <code>tree</code>:<pre><code>+------+-------+| id | name |+------+-------+| 0 | tree1 || 1 | tree2 || 2 | tree3 || 3 | tree4 |+------+-------+</code></pre>A table <code>pen</code>:<pre><code>+------+------+| id | name |+------+------+| 0 | pen1 || 1 | pen2 || ...
Conditional table reference
dba
2018-02-03T14:18:55.910
[ { "message": "The B-Tree and the R-Tree are two similar index structures that PostgreSQL offers in its implementation.Both structures can have at most <code>m</code> children per node and as other tree structures, children can have other children. However, in my test data, my structures are always in the form o...
How can we foresee (and configure) B-Tree and R-Tree indexes width and depth in PostgreSQL?
dba
2018-02-04T23:09:15.710
[ { "message": "I am developing the backend for a service that resembles Uber in some aspects (just a simplification to give you the general context). Users will book rides and as such users will define the pickup and drop-off locations. These locations will be addresses in a city (with the possibility of multipl...
Should I create a separate table for geo-location points?
dba
2018-02-05T08:33:52.427
[ { "message": "I would like to know how to add a version number to a SQL Server Agent job without using the description field, and with it being an attribute of the job.A similar question was asked at StackOverflow <a href=\"https://stackoverflow.com/questions/15411316/sql-server-agent-job-adding-version-number/...
SQL Server Agent Job - Adding Version Number
dba
2018-02-05T18:42:07.427
[ { "message": "I would like to know how to add a version number to a SQL Server Agent job without using the description field, and with it being an attribute of the job.A similar question was asked at StackOverflow <a href=\"https://stackoverflow.com/questions/15411316/sql-server-agent-job-adding-version-number/...
SQL Server Agent Job - Adding Version Number
dba
2018-02-05T18:42:07.427
[ { "message": "I have a table of widgets that have a number of connections with potentially overlapping modes. For instance, widget A may have 10 connections, and 5 of those can run in mode A and all 10 can run in mode B. A connection has at least one supported mode. I'm trying to figure out how to design a quer...
Postgres: multiple selects that exclude results from previous ones
dba
2018-02-05T21:04:40.753
[ { "message": "Tables: <code>Users</code>, <code>Costs</code>, <code>Payments</code>Users can have many costs. Costs can have many paymentsI want to get information about the user AND count of all payments that they madeThis query returns result but takes very long time to run<pre><code>SELECT u.id, u.name, ( ...
Count total number of nested one to many relationships
dba
2018-02-06T19:56:57.173
[ { "message": "In our production DB, we only have 1 tempdb file and it had ballooned to 180GB.I ran:<pre><code>Alter Database tempdbmodify file (name='tempdev', size=30gb);</code></pre>to resize the primary file, and then ran additional:<pre><code>ALTER DATABASE tempdbADD FILE (NAME='tempdev2', FILENAME='M:\\SQL...
Unable to remove additional tempdb file
dba
2018-02-07T01:57:34.033
[ { "message": "I am trying to select many columns from a table where there can be multiple rows with the same ID. Each row contains data from columns that I want to return in one row. Any time a column has a value other than NULL, I want to show that. If all values in that column are NULL, it is OK to show NU...
How to select TOP 1 value from each column where value is not null
dba
2018-02-07T16:54:40.873
[ { "message": "I have a script file in my local machine. I have to open SSMS and open the query in SSMS and to execute the query.For opening the SSMS and query, i have used the following PowerShell script to do it.<pre><code>ssms.exe 'E:\\PowerShell_PROD\\Screenshot\\ServerDetails.sql' -E -S localhost</code></pr...
How to execute SQL Server query in SSMS using PowerShell
dba
2018-02-08T05:46:43.757
[ { "message": "I know it might sound silly, I have to look up MySQL manual reference and another MySQL forum. as I could not find what is right datatype for numbers with '-' e.g '405-6444235-1711500' I'm not sure this number datatype like TINYINT, SMALLINT, MEDIUMINT INT and BIGINT will not working on this.I'm...
What is right datatype with numbers along with '-'
dba
2018-02-09T12:36:52.797
[ { "message": "I saw several videos where the know procedure sp_blitzfirst shows the memory grant columns, I even saw it working like that, but on the latest version of the first responder kit, it doesn't show those columns, were those removed?When I execute it with @expertmode=1 it just show on the messages tab...
sp_blitzfirst not showing memory grant columns
dba
2018-02-09T13:35:33.397
[ { "message": "Consider a database with the following structure:Tables[dbo].[Customer], [dbo].[Address], and [dbo].[Report]Schemas[dbo] and [Reporting]What I would like to be able to do is to have a principal (could be user or role) be able to manage views (CREATE, ALTER, DROP) in the Reporting schema only. Fur...
Granular Security in SQL Server
dba
2018-02-09T17:40:58.857
[ { "message": "<pre><code>Update tbl1 set col1 = 1 where id = 1</code></pre>The same update ran a few miliseconds apart. It causes deadlock. Id is primary clustered key.I read about lock partition. is there any other way to resolve this kind of deadlock?Please see below Deadlock graph. Thanks.unknown unknown ...
Two simple updates is deadlocking
dba
2018-02-09T20:14:07.610
[ { "message": "I have a GFI receptacle in the garage that protects the bathrooms and outside receptacles, everything is three pronged. Recently the circuit has been shutting off on a regular basis. I thought I had found the problem in the outside outlet where the face was cracked so I replaced the outlet this ...
GFI frequently tripping
diy
2017-06-09T06:37:20.727
[ { "message": "I would like to turn my basement into an apartment. It has a kitchen and a bathroom and some unfinished space, but there is no bedroom and the windows are laid out in a way that makes it hard for me to imagine where the bedroom would go (needs to have a window).Here's the general layout:<a href=\"...
Basement apartment layout
diy
2017-06-09T07:02:51.360
[ { "message": "Someone did me a favour and sand and cemented​ by porch (long story). It had a few cracks afterwards and as I had lots of other things to filler I decided to filler all of the cracks \"while i was at it\". Yesterday I gave the wall a mist coat and now deeply regret my filler as the smooth patches ...
Rectify smooth filler patches on sand and cement skimmed wall
diy
2017-06-11T10:33:02.653
[ { "message": "I have a Goodman Janitrol furnace and I am needing to add a C (common) wire, for the newer thermostats. I would like to avoid the substituting G for C, and just run an additional wire.I have read several post that suggest to use one of the Blue wires coming from the furnace transformer. I have att...
Adding a C (common) wire to my Goodman (Janitrol) furnace
diy
2017-06-12T02:19:51.920
[ { "message": "As the below picture, is the rough blue print of the 12'6\" x 12\" deck for my new house. Following the code, all joists(blank rectangular) are 2 x 8 16\" OC, the blue rectangular is the beam, and gray rectangular is ledger board which already attached to house by builder. The yellow rectangular i...
How to frame the side cantilever joist for deck?
diy
2017-06-12T05:03:19.483
[ { "message": "We want to brick veneer our chimney breast (Which has a TV mounted to it) but I had a thought that would allow us to hide the wires, brick veneer the wall and also keep the wall behind in a clean state that would allow us to easily revert the brick veneer if we so wish. However... I'm most certain...
How feasible is a brick veneer fake wall?
diy
2017-06-17T18:43:50.320
[ { "message": "When determining drain vents, 2\" can have a vent 8' away and 3\" can have the vent 12' away, how does that work in terms of wet venting? I have a toilet flange connected to a line that has a Wye which picks up my sink approximately 4' down stream. So technically, I have a vent connected to my t...
Wet Vent distance for Toilet Drain
diy
2017-06-17T21:02:24.027
[ { "message": "I am in the process of installing a new thermostat that requires a c wire. I checked my thermostat to see if it has a c wire running to it and it does not. After doing lots of googling and watching youtube video I think I know what to do but would like somedody that knows to verify it is correct b...
Needing Help with new thermostat install (C Wire)
diy
2017-06-20T06:01:23.537
[ { "message": "I want to install a 100 Amp panel to my attached garage. The location is about 50-60' from my service panel, which is 200 amp utility service. The purpose of this circuit is for a small pottery kiln and circuits for things like a table saw, miter saw, drill press, misc. small things and new ligh...
Looking to setup a 100Amp panel in my attached garage and have ideas/questions
diy
2017-06-21T14:54:25.567
[ { "message": "I'm confused about the recommendation that \"The primer must not form a closed, shiny film\" found in quite a few primers sold in the EU as basis for emulsion (US =\"latex\") paints, e.g. in <a href=\"http://www.caparol.de/uploads/pics/caparol_import/caparol_de/ti/73971/TI_651_EN.pdf\" rel=\"nofol...
Primer must NOT form a film?
diy
2017-06-25T16:58:18.863
[ { "message": "I am building an 8'6\" x 20' tiny house on wheels and am trying to size up the ridge beam. The 2x6 rafters are placed 24\"oc and are mounted to beam with Simpson Strong-Tie hangers. The beam rests on 4x4 end posts. The roof will be vaulted on the interior, so no collar ties. Here are some specs:Cu...
Ridge beam sizing for an 8'6" x 20' tiny house
diy
2017-06-25T19:49:00.753
[ { "message": "I have a wall mounted mini split (Fujitsu 9,000 BTU) installed in my bedroom over my bed, intended to heat and cool my upstairs (there has no suitable location in the hallway). It is a standard sized bedroom, and the heat pump does an excellent job cooling and heating the room (I can get the room...
Ductless Mini Split heat pump not cooling / heating outside of room
diy
2017-06-28T16:58:55.060