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": "I need to copy records within the same table changing only one field.My table has default-generated sequence <code>entry_id_seq</code>, however I am not sure <code>id</code> column is SERIAL (how to check that?).<code>\\d tab</code> returns just this<pre><code> Column | Type...
INSERT INTO table FROM SELECT * with nextval() specification
dba
2017-05-09T15:18:33.560
[ { "message": "I created some tables (9, to be exact) with a Django (1.9.6) migration and now I'm trying to get simple <code>CREATE TABLE</code> statements for them. I tried <a href=\"https://stackoverflow.com/a/2594564/3704831\">this answer, but using <code>pg_dump</code> in this way gives me over 800 lines of ...
Getting Postgres CREATE TABLE statements
dba
2017-05-09T21:47:01.297
[ { "message": "Since the last days, i have been trying to migrate a MySQL database to PotsgreSQL, but there is a problem that doesn't let me succed: A bit column.I have tried different methods: First i tried to use pgloader, because it seemed as the easiest, but i don't know how to write a script for this, so i ...
How to migrate from MySQL database to PostgreSQL if having a bit column?
dba
2017-05-10T00:34:26.537
[ { "message": "So I have an execution plan I'm trying to optimise, and there's a section of an operator I can't quite understand.There is a section of the plan where a Compute Scalar is used, followed by an aggregation using a hash match.I have a questions:How can I use the properties of the hash match aggregato...
Help with interpretation of execution plan (Hash Aggregation)
dba
2017-05-10T09:06:42.273
[ { "message": "I have an <code>orders</code> table and need to calculate when there is a change in the average count across time. This could be either an increase or decrease.For instance, if there is usually 1 order every two days, I need to detect if that suddenly increased to 3 orders every day or decreased t...
Calculating interval in days based on average velocity
dba
2017-05-10T13:20:36.973
[ { "message": "I am attempting to use a Left Outer Join to return data from two tables. MetaKnight has the most storeNames and I want all of those to be returned, and of course the corresponding data from KnightNinja. I threw together the below syntax, but my syntax is only returning the name of the stores in ...
Query Only Returning Matching Data
dba
2017-05-11T13:29:56.257
[ { "message": "I am in a strange situation where I am not able to update rows in my View via SSMS. It gives me following error.<blockquote> Error Source: sqlserver management datatools Error Message: the row value updated or deleted either do not make the row unique or they alter multiple rows</blockquote>How...
MSSQL Unable to edit data through SSMS
dba
2017-05-11T14:19:01.213
[ { "message": "Good day all, I have a unique requirement where I need to generate a .csv file containing data for each userID. The result set that I have returned from my select statement is <blockquote> userID numOfSales saleDate meetMark<br> ec12 4 2017-01-02 No<br> ec12 3 2017-01-03 No<...
Generate CSV Email For Each UserID In Table
dba
2017-05-11T15:55:42.477
[ { "message": "I've a query<pre><code>SELECT t1.user,t1.answer as 'Q1',t2.answer as 'Q2'from (select answer,user from survey_answer where question_id=45) t1JOIN(select answer,user from survey_answer where question_id=46) t2ONt1.user=t2.user</code></pre>In this the <code>question_id</code> i.e. 45,46,47,48,...etc...
Select a table with multiple columns according to IN clause
dba
2017-05-11T16:31:40.373
[ { "message": "I have a <code>messages</code> table with some fields like <code>id</code>, <code>version</code>, <code>timestamp</code>I'm trying to insert and retrieve messages with real-time deduplication logic, implemented in stored procedures.On insert, if a message with given <code>id</code> already exists ...
Real-time deduplication strategy for relational DB
dba
2017-05-11T16:33:24.483
[ { "message": "Environment is SQL 2008 R2, 26GB RAM, 4-core Xeon E5-2650 @ 2.6GHz.Please see the image below, our maintenance plan which reorganises indexes (not rebuilds). This is run on a weekly basis, and within one week, this plan went from taking ~5 minutes way up to 1hr - 1hr:15, and it has not improved si...
Diagnosing a maintenance plan that's ballooned in execution time
dba
2017-05-12T10:19:53.257
[ { "message": "I am trying to insert queries from a sql file in shell script using sqlplus. Now, some queries can fail because of incorrect schema.So I want to commit all transactions only if all queries succeed.The main problem is that, I would like to execute all queries irrespective of any error and rollback ...
How to preserve sqlplus session in shell script
dba
2017-05-13T17:24:35.087
[ { "message": "I'm trying to achieve a <code>full outer join</code> in MySQLEDIT : As per comments:Data is <a href=\"https://i.stack.imgur.com/ZMReP.png\" rel=\"nofollow noreferrer\">Need data with for <code>question_id in(44,45,46,47,48,49)</code>Desired Output is :<a href=\"https://i.stack.imgur.com/Fd00e.png\...
Join Multiple Derived Tables, Correctly in MySQL?
dba
2017-05-14T15:46:27.830
[ { "message": "I have a situation where I have a constraint on TempDB to not exceed 350 GB in size. I'm using <code>autogrowth 10</code> (percent) on TempDB, as I've read that it is supposed to be best practice on databases exceeding 500 MB. When I used <pre><code> dbcc checkdb with estimateonly </code></pre>on ...
Risks associated with automatically shrinking TempDB as a SQL agent job?
dba
2017-05-15T07:02:20.087
[ { "message": "When I clone an existing MySQL server, it takes for the same query executed against the same data and producing the same results significantly more time to execute on the new server. It seems the query is running forever (over 5 mins before I kill it as opposed to 15-20 second on the origin server...
Performance after creating new MySQL server
dba
2017-05-15T07:51:36.733
[ { "message": "Doing my first backup and restore of someone else's sql server database. I have already done a successful backup and restore of one of the databases, but the other two are locked behind Transparent Data Encryption. Is there a simple way of finding the certificates' files and just copy/pasting them...
Backup and restore Transparent Data Encrypted database
dba
2017-05-16T00:10:29.797
[ { "message": "I need a database for backends (for iOS apps). Those are mostly low-load demand applications and I like mongo for it's schemaless-ness. I'm looking to host both db and app server on a small digital-ocean instances.I plan to:run it under systemctl on debian probablyhave periodic backups (not sure y...
Single server / instance mongodb deployment
dba
2017-05-16T21:17:58.340
[ { "message": "I have a table which contains folders' paths. This table contains four columns:<code>DirID</code> - The folder's ID.<code>BaseDirID</code> - The ID of the first folder in the hierarchy. So all the folders (paths) from the same hierarchy share the same value in this column.<code>DirLevel</code> - T...
Find missing folders paths in split hierarchies
dba
2017-05-17T08:31:53.907
[ { "message": "Im using mariadb 10.0.29, I need to change the innodb file size to 256M, default size 50M,My config file is located on <pre><code>/etc/mysql/mariadb.conf.d/50-server.cnf</code></pre>I have added the below line, but it won't work.<pre><code>[mysqld]innodb_log_file_size=256M</code></pre>Also I trie...
Mariadb - Variable 'innodb_log_file_size' is a read only variable
dba
2017-05-17T08:45:06.710
[ { "message": "We have a table containing around 500k rows. The database table is supposed to grow to million of records.This is how the table looks like:<pre><code>CREATE TABLE public.influencers( id integer NOT NULL DEFAULT nextval('influencers_id_seq'::regclass), location jsonb, gender text COLLATE p...
Best index for jsonb in Postgres
dba
2017-05-17T10:01:46.617
[ { "message": "Scenario:I am trying to understand a strange situation. I have a SQL Server 2012 having DB engine and SQL Server agent configured using same domain account. That domain account isn't added to SQL Server logins. Checked using <code>xp_logininfo 'Domain account', 'all'</code> and didn't get any outp...
SQL Server agent job question
dba
2017-05-17T11:17:35.123
[ { "message": "We've created the following table:<pre><code>CREATE TABLE public.influencers( id integer NOT NULL DEFAULT nextval('influencers_id_seq'::regclass), location jsonb, gender text COLLATE pg_catalog.\"default\", birthdate timestamp without time zone, ig jsonb, contact_info jsonb, c...
Query results not as expected - Jsonb Postgres
dba
2017-05-17T15:41:46.987
[ { "message": "Our SSAS cube has a date dimension, which for the DayName string member displays alphabetically instead chronologically. I added a DayOfWeek integer 1-7 to use for ordering. I have two options to accomplish this, not sure of the advantages/disadvantages of either.Make DayName attribute visible, an...
SSAS - Which way to order an attribute?
dba
2017-05-18T12:33:44.443
[ { "message": "At my work we have three different environments: dev, test, and prod. We also quite a few different SSIS packages. Currently, when we need to deploy to a particular environment, we update the connection for the package in Visual Studios and deploy it to the correct environment. I'd like to make...
Send environment info to package
dba
2017-05-18T21:28:46.200
[ { "message": "We ha a Fact table with 500 milions of rows (data from 10 years - 60GB). I've partitioned this table on database level and SSAS Tabular Cube level as well - one month per partition to improve the overall browsing performance and SSAS Cube processing time. But last time I've heard that configuring ...
SSAS Tabular Cube partitioning - number of partitions
dba
2017-05-19T09:09:09.183
[ { "message": "Following is MySql Table in the snapshot: <a href=\"https://i.stack.imgur.com/dX6PR.png\" rel=\"nofollow noreferrer\">column sno could be found in the other rows in column p_sno. i.e.<pre><code>sno = 5 linked through p_sno = 5 with sno = 6 (two rows)sno = 8 linked through p_sno = 8 with sno = ...
How to retrieve all the rows where primary key value found in the other column in the row in MySql
dba
2017-05-20T04:20:08.930
[ { "message": "I have a role <code>ExecSP</code> which I use to manage who can execute stored procedures. <code>EXECUTE</code> permission is granted on all SPs to this role.I also use SQL Server Data Tools (SSDT) to manage MS SQL Server database schema.In the file where my SP is defined, I have this:<pre><code>C...
GRANT EXECUTE ON SomeProc TO SomeRole AS dbo
dba
2017-05-22T07:38:04.147
[ { "message": "Can anybody explain why FIND_IN_SET isn't returning the row with the NULL value? To me it seems obvious, the string \"test\", isn't part of NULL, so it should return it?<a href=\"http://sqlfiddle.com/#!9/389043/2\" rel=\"nofollow noreferrer\">http://sqlfiddle.com/#!9/389043/2<pre><code>CREATE TABL...
Why doesn't FIND_IN_SET return on NULL values
dba
2017-05-22T11:09:31.907
[ { "message": "I am trying to understand how to model a certain type of relationship.I have a dataset that I would like to put into a database, however, I have this relationship among two columns in my data. Here is a sample of what I am looking at:<pre><code>Company_ID1 Company_ID2 9581091 5350631...
How do I model a many-to-many relationship on two different columns?
dba
2017-05-23T13:48:41.897
[ { "message": "I am working in a player versus computer web application which is a version of \"Rock-Paper-Scissors-Spock-Lizard\".I should be able to provide some statistics like for example:How many times the user has won, lost and draw?How many times the computer has won, lost and draw?How many times the user...
Rock-Paper-Scissors-Spock-Lizard statistics DB design, is there a better way to achieve this?
dba
2017-05-23T14:24:17.563
[ { "message": "Been struggling with this one for a good while now. I'm trying to use <code>sp_executesql</code> below:<pre><code>DECLARE @SQLString nvarchar(500); DECLARE @ParmDefinition nvarchar(500); DECLARE @IntVariable int; DECLARE @fulldbtablename nvarchar(500); DECLARE @ID bigint; SET @fulldbtablena...
dynamic sql - assigning variable a value from result of dynamic sql query
dba
2017-05-23T14:52:22.393
[ { "message": "When I run this command with <code>SUM()</code><pre><code>SELECT COUNT(*) AS [Records], SUM(t.Amount) AS [Total]FROM dbo.t1 AS tWHERE t.Id &gt; 0 AND t.Id &lt; 101;</code></pre>I'm getting,<pre><code>Arithmetic overflow error converting expression to data type int.</code></pre>Any idea on...
SQL Server returns "Arithmetic overflow error converting expression to data type int."
dba
2017-05-23T16:55:20.610
[ { "message": "ScenarioWe want to study behavior of some similar entities that changes based on time.Currently I'm using MS SQL Server 2016 Table Structure<pre><code>CREATE TABLE [dbo].[BehaviorHistory]( [EntityId] [uniqueidentifier] NOT NULL, [BehaveFactor] [bigint] NOT NULL, [TimeOffset] [bigint] NOT...
Bulk insert and fast ordered search large data 3B+ records
dba
2017-05-24T09:07:48.463
[ { "message": "Given the following query:<pre><code>DECLARE @14DayWindow Datetime = DATEADD(day, -14, GETDATE())DECLARE @90DayWindow Datetime = DATEADD(day, -90, GETDATE())SELECT * FROM (SELECT ID, COUNT(ID) FROM SomeTable WHERE SomeDate &gt; @14DayWindow GROUP B...
How can I write a query to recursively execute with varying parameter values?
dba
2017-05-24T13:31:16.107
[ { "message": "I have an CSV file with <code>WE8ISO8859P1</code> encoding generated from Oracle Stored Procedure. Is there any script line to define the output of <code>CSV</code> file in UTF-8 encoded format?<pre><code> CREATE OR REPLACE PROCEDURE export_main(dir VARCHAR2, file_name VARCHAR2) IS select_stmt VA...
How to export data in Oracle database into CSV file with UTF-8 format?
dba
2017-05-25T07:57:43.640
[ { "message": "I have two tables, <code>Lpn</code> and <code>Uld</code> that will relate on one column, that is, <code>UldNo</code>.To give some background on the issue An <code>Lpn</code> is a label that is assigned to one or more pieces of freight in a warehouse. A <code>Uld</code> is a pallet that the freight...
Is a composite key correct here?
dba
2017-05-25T17:40:03.240
[ { "message": "I have a windows 10 box with SSMS 17. I had SSMS 2016 installed, but it is now uninstalled. When I go to install the SqlServer module I get this warning:<pre><code>C:\\WINDOWS\\system32&gt; install-module sqlserver -Scope AllUsersUntrusted repositoryYou are installing the modules from an untrusted...
Is it normal for Install-Module SqlServer to clobber existing modules?
dba
2017-05-26T17:29:23.533
[ { "message": "Say I have a local database named MyDatabase. I want to move it to Azure SQL and replace an existing database currently residing there named MyDatabase. I know how to create a BACPAC file locally. I know how to import the BACPAC to my Azure storage account. However, once the BACPAC is in Azure sto...
How to Import a BACPAC file to Azure SQL and Overwrite Existing Database?
dba
2017-05-26T21:39:37.237
[ { "message": "<a href=\"https://msdn.microsoft.com/en-us/library/windows/desktop/dd979523(v=vs.85).aspx\" rel=\"nofollow noreferrer\">https://msdn.microsoft.com/en-us/library/windows/desktop/dd979523(v=vs.85).aspx says that Windows does not support write-through on SATA drives: \"Starting in Vista, Windows supp...
Does SQL Server work on SATA drives?
dba
2017-05-28T03:15:39.990
[ { "message": "This just came to me when helping my friend with his homework. Is it possible to know our role (implicit, not know to us) role grants as full access to a full table or just to a view derived from the table? The table [Table] contained a field[Class] indexed alphabetically, i.e., A,B,C,...,Z . Th...
How to Know if I have A Restricted or Full Access to Table
dba
2017-05-28T23:01:03.043
[ { "message": "So I have a CentOS server that I have started to configure replication on my local machine. When I take a look at the master server with <code>show master status;</code>, I get the following:<pre><code>+------------------+----------+---------------------+------------------+-------------------+| F...
Slave Connection 1130
dba
2017-05-29T00:26:55.917
[ { "message": "My application has been logging dead lock exceptions return from sql azure to my .net application: <code>Transaction (Process ID 152) was deadlocked on lock resources with another process...</code>.I would like to investigate this further to see if I can prevent those deadlocks from happening.How ...
Get sql azure dead lock info
dba
2017-05-29T01:25:14.023
[ { "message": "According to postgresql uuid-ossp documentation <code>uuid_generate_v1()</code> is based on Mac address + timestamp:<a href=\"https://www.postgresql.org/docs/9.4/static/uuid-ossp.html\" rel=\"nofollow noreferrer\">https://www.postgresql.org/docs/9.4/static/uuid-ossp.htmlOn a distributed database s...
May postgresql's uuid_generate_v1() conflict when we change the computer date/time?
dba
2017-05-29T12:26:18.363
[ { "message": "mysql 5.7.18 (both master and slave)error in slave status<pre><code>Last_IO_Error: Master command COM_REGISTER_SLAVE failed: Access denied for user 'repl'@'xxx.xxx.xxx.xxx' (using password: YES) (Errno: 1045)</code></pre>error on master (error.log)<pre><code>2017-05-29T16:40:39.718290Z 213 [Note] ...
mysql replication - slave can't connect to master
dba
2017-05-29T15:29:08.447
[ { "message": "I am trying to retrieve chunks of records from my table via a generated <code>SELECT WHERE IN</code> statement. If the statement is small, it will use the index, if the statement is large (1000+ IN items) it performs a full table scan. The table is 17 million rows long, so this gets expensive when...
MySQL not using index on large WHERE IN clause
dba
2017-05-30T19:38:29.450
[ { "message": "My understanding, reading between the lines, is that BDR replicates row by row, starting after the COMMIT. I have a requirement to be able to then wait until some nodes have actually replicated my latest commit. If not, I will report the problem upstream. And maybe mark the transaction as dubio...
Ensuring Postgresql BDR replication
dba
2017-05-31T05:37:40.440
[ { "message": "Apparently only the new values of rows are sent between nodes on update. So how can there ever be detectable conflict? Node A receives an update from Node B, and a different update from node C. How can A know that there was a conflict? That the B and C updates were not conducted in some well ...
Postgresql BDR Update Update conflict detection
dba
2017-05-31T08:45:27.937
[ { "message": "Few questions on ops-manager backup processWhile backup ops manager creates a head db which is copy of the monogdb deployment I want to know the reason behind this. Why create another copy and increase space consumed for backup Ops manager takes snapshot of the head db which got created where Back...
Ops Manager backup process
dba
2017-05-31T10:26:32.747
[ { "message": "Even though I'm (apparently) setting the search_path correctly I still have to prefix everything with the schema. What's wrong here? How do I get a default schema from the search_path?<pre><code>psql blippsql (9.4.1, server 9.4.4)Type \"help\" for help.blip=&gt; \\dt messagesno matching relations...
search_path set and seen but not used!
dba
2017-06-01T07:04:13.893
[ { "message": "I'm not sure my question is clear so let's me rephrase it. I have three tables organized like that:<a href=\"https://i.stack.imgur.com/eVPxN.png\" rel=\"nofollow noreferrer\">I want to make a dump of these tables but I'm not interested by all the rows, I just want those who were last updated durin...
How to export some rows of multiple tables linked between them according to one column value?
dba
2017-06-01T10:02:25.233
[ { "message": "We have the following backup regime in place which I am not 100% sure about.Full backup each night at 18:00 taking approx. 6 hoursTransaction log backup upon completion of full generally about 10 mins.Differential backups each hour taking approx. 20 mins.When querying the msdb.backupset table, I u...
LSN numbers query regarding Differential backups
dba
2017-06-01T11:16:08.057
[ { "message": "Looking for a Postgres 9.6 function that reverse sorts a string the same way that java namespaced packages do. Preferable if this is just PGSQL, I know that this is simple in the V8 engine or Python.I.e. if I have the string <code>foo.bar.baz.example.com</code>, I want the string <code>com.exampl...
Writing functions in Postgres that returns strings with dots in reverse like java namespaces
dba
2017-06-01T17:59:10.493
[ { "message": "I am not getting the right problem what might be making the mongodb shell not getting initiated.<br>Here is the gist of my log of MongoDB: <a href=\"https://gist.github.com/JafferWilson/c6f964060bc27014d25e22066ed5f292\" rel=\"nofollow noreferrer\">https://gist.github.com/JafferWilson/c6f964060bc...
Why my mongodb Shell not getting started even after my mongodb server is running?
dba
2017-06-02T06:53:32.220
[ { "message": "I had a discussion today regarding an incident in a percona cluster. The setup was as follows:A three node percona cluster load-balanced by a haproxy. Both reads and writes where balanced by the proxy to all three nodes. The application (php) using the database, was coded as such, that it could pe...
Is it possible to have read/write race conditions in a percona cluster?
dba
2017-06-02T12:49:59.517
[ { "message": "I have two SQL Server named instances, <code>InstanceA</code> and <code>InstanceB</code> on one computer, and they correctly show up under <code>Sql Server Configuration Manager</code> | <code>SQL Server Network Configuration</code>. However, when I try to configure <code>SQL Native Client 11.0 Co...
Sql Server Configuration Manager
dba
2017-06-03T04:51:40.757
[ { "message": "I have a query which selects number of records for each house.<pre><code>SELECT -- 3 rows a.house, -- 12 rows (for each house) a.id, -- for each ID (there are 4 repeating records) -- out of these 4 records, only 1 is unique while remaining are -- repeated records a.pointsFROM reco...
How to select unique records in PostgreSQL without using Distinct clause
dba
2017-06-04T14:48:46.250
[ { "message": "I have a database table in which a row has its matching pair. Checkpoint A has a matching pair checkpoint B. Every IN status has a matching OUT status. To match these exists a 'related_id' column with the id of the row it is related to.Normally the table order can be as follows:<pre><code>id | reg...
Arrange SQL Server rows in a paired sequence
dba
2017-06-05T13:55:05.190
[ { "message": "Is there a way to configure SSRS 2016 to be able to send email from more than one email account? I am looking to setup something that is department specific for our organization. Right now its defaulting to one department and it doesn't really fit our growth plans.", "role": "user" }, { ...
Reporting Services 2016 Multiple Email Accounts
dba
2017-06-05T15:07:25.367
[ { "message": "I have several small sites and I've just rented a Windows VPS server with 1&amp;1. It includes 2 \"vCores\", 4 GB RAM and 120 GB SSD.It runs great for my needs but now I need to determine the best way to get several SQL Server databases running.Questions:Would SQL Server Express kill such a config...
Best way to get SQL Server databases on small capacity VPS
dba
2017-06-05T23:32:38.270
[ { "message": "I want to create a pair of table with a structure along the lines of:<pre><code>CREATE TABLE tableA ( ext_id bigint NOT NULL, local_id int AUTO_INCREMENT NOT NULL, /* &lt;-- Requires MyISAM (InnoDB doesn't support this) */ PRIMARY KEY (ext_id, local_id), );CREATE TABLE tableB ( ext_...
MySQL using AUTO_INCREMENT of secondary coloum of index, and FOREIGN KEY at the same time
dba
2017-06-06T08:43:39.513
[ { "message": "In learning how to get the date of a day of the week from the previous week (e.g. the date of Monday from the previous week), I found the following two expressions coming up commonly, where you change the very last number (e.g. 0=Monday) depending on which day you want:<pre><code>SELECT DATEADD(wk...
Getting the Date of Some Day of Last Week
dba
2017-06-07T12:39:33.907
[ { "message": "I have latest version of <code>sp_blitzindex</code>. Would like to store results in table. Runs no output, anyone doing this already?Running with parameters below:<pre><code>EXEC dbo.sp_BlitzIndex @databasename = 'ngprod', @OutputDatabaseName = 'dbaadmin', @OutputSchemaName = 'dbo', @Out...
sp_blitzindex output
dba
2017-06-07T14:11:18.460
[ { "message": "I have read numerous article and different blogs of SQL Server . I have an unique problem in this case. Let me explain you my problem statement.I have many tables and i cannot union it all.So, i am trying to get the one column value (It can be string or null value)if the value doesn't exist in tab...
How to write the SQL Query to find different table value
dba
2017-06-07T19:46:35.677
[ { "message": "I executed this manually:<pre><code>GRANT SELECT ON TABLE my_table TO some_user;</code></pre>How can I dump this statement again?I looked at <code>pg_dumpd</code> but only found a way to do a data-only dump or a schema-only dump.If I do the following, then I get both (CREATE TABLE and GRANT statem...
pg_dump: Show GRANT Statements only
dba
2017-06-08T07:14:42.947
[ { "message": "I noticed there is a bug that when people asked about it, they were sent in the wrong direction (see final remarks below).When trying to use SQL Server 2016 with SSMS 17.1 to create a mirrored database, the following errors might be received:<blockquote> Database is not configured for database mi...
SQL Server Management Studio 17.1 Mirroring bug
dba
2017-06-08T23:21:58.170
[ { "message": "My server configuration has auto_commit = off which helps in large transaction while inserting and updating but what if innodb_autoinc_lock_mode = 1 as my tables does not have primary key with auto_increment? will it help in faster results or do we need to make to 2? is there any way to help it?",...
regarding transaction commit in mysql?
dba
2017-06-09T07:29:30.987
[ { "message": "Can anyone tell me what is the easy way to backup 500Gb datasize on windows environment ? My physical memory is 672 GB RAM on server?Which tools will be fast to back up and restore?Note : mysqldump will take more than 1 week for 500GB datasize Any suggestion with details and is there way any way a...
Need help in mysql database backup on Windows except mysqldump?
dba
2017-06-09T09:12:56.657
[ { "message": "I am running a sql script on mysql 5.7.18 ubuntu server 16.04 that does a large number of updates in one table. Each one of the 50k updates takes under a second but the total run time is very long (>20m).I can see from PROCESSLIST that only one thread is running and is processing the updates one-b...
Run queries in parallel
dba
2017-06-09T12:53:52.897
[ { "message": "I have a database and want to select from mysql a result which could not succeed after one month please help me it would be really appreciated!My Database Table looks like below and Name = Customer<pre><code>Id customer_id customer_name Date Books_bought1 1 ...
Select from SQL
dba
2017-06-09T18:01:09.000
[ { "message": "I downloaded <a href=\"http://download.oracle.com/otn/other/virtualbox/dd/DeveloperDaysVM2016-06-02_13.ova\" rel=\"nofollow noreferrer\">DeveloperDaysVM2016-06-02_13.ova from <a href=\"http://www.oracle.com/technetwork/database/enterprise-edition/databaseappdev-vm-161299.html\" rel=\"nofollow nore...
How do you create a new database with new sid on Oracle's pre-built 11g virtual machine?
dba
2017-06-09T21:40:16.503
[ { "message": "Hello my little snowflakes, how can I isolate the correct time part of a timestamp?<pre><code>SELECT CURRENT_TIMESTAMP() AS a, CURRENT_TIMESTAMP() :: timestamp_ntz ...
Getting timepart from timestamp
dba
2017-06-12T01:35:29.043
[ { "message": "It is stated in the MongoDB documentation FAQ (<a href=\"https://docs.mongodb.com/manual/faq/storage/#wiredtiger-storage-engine\" rel=\"nofollow noreferrer\">https://docs.mongodb.com/manual/faq/storage/#wiredtiger-storage-engine) :<blockquote> Avoid increasing the WiredTiger internal cache size a...
WiredTiger internal cache
dba
2017-06-12T10:27:38.043
[ { "message": "I have a login table, which registers <code>datahora_ini</code> (system entry time) and <code>datahora_fim</code> (system exit time). Sample data:<pre><code>CREATE TABLE login(cod_user,datahora_ini,datahora_fim)AS VALUES ( 101::int, '2017-06-02 08:02:14'::timestamp, '2017-06-02 13:59:23'::time...
Extracting sum of time in a period
dba
2017-06-12T15:02:30.020
[ { "message": "Let's say I run <code>CREATE DATABASE abcd</code>, PostgreSQL will create an empty database and if I run <code>SELECT pg_size_pretty(pg_database_size('abcd'));</code>, I get size of the database, let's say 8000kB. What I want to know is will the size of the empty database always be the same no mat...
Does PostgreSQL always initialize database of same size?
dba
2017-06-12T19:41:39.247
[ { "message": "I'm using MongoDB 3.4 for saving other systems logs and mongoconfig.log is getting too much verbosity. It's a sharded clusted, if that helps. I checked the default mongo log verbosity and is set at default (0). But I believe this is another setting not found under /etc/mongod.conf<pre><code>2017-0...
How to disable ChunkManager logging for MongoDB? mongoconfig.log gets huge
dba
2017-06-13T07:22:04.660
[ { "message": "Recently my client database has restarted and thrown the below error.<pre><code>FATAL: could not create shared memory segment: Cannot allocate memoryDETAIL: Failed system call was shmget(key=5433001, size=5616156672, 03600).HINT: This error usually means that PostgreSQL's request for a shared m...
POSTGRESQL error Could not create shared memory segment: Cannot allocate memory
dba
2017-06-13T08:45:01.973
[ { "message": "This is my issue.I've set up a test environment with SQL Server 2014, 2 named instances, WSFC and AG. They're set up like this.<pre><code> sqllab04\\inst01 - sqllab05\\inst01 - Listener VT-DB-LAB02 (port 1433) sqllab04\\inst02 - sqllab05\\inst02 - Listener VT-DB-LAB03 (port 1433)</code></pre>Both ...
SQL Server 2014 Always on listener on named instance for default port
dba
2017-06-13T09:29:04.793
[ { "message": "Secondary node of mongodb cluster has entered in Recovering state and it's not coming out of it. Below is what I see in log. I know one way to fix this issue is to reinitialize secondary node by deleting data directory and restarting secondary. But I don't want to try that option as I have 2 tb of...
Mongodb Secondary Node not recovering
dba
2017-06-13T12:10:39.517
[ { "message": "After long and useful discussion with Mr. <a href=\"https://dba.stackexchange.com/users/1876/rick-james\">Rick James about how to change to innoDb , and after one week of changing a big table from myisam to innoDbi feel there is som improvements can be don, and i am seeking for community advice.Pl...
Optimizing MYSQL Configuration for InnoDb
dba
2017-06-14T03:15:41.927
[ { "message": "We have a t2.medium instance on AWS' RDS platform (4gb, 2xCpu). We're using MariaDB 10.1.19 with a single database, ~120 tables and ~2gb of data in total.After running for about a week we get this error, at first only some requests, then on the heavy requests and then it starts affecting more quer...
'Out of memory' Error for MariaDB on RDS
dba
2017-06-14T12:37:35.587
[ { "message": "I am trying to alter a database column by using:<pre><code>ALTER TABLE [table name] MODIFY id bigint;</code></pre>I searched and found out that the table gets locked during the ALTER process. How do the inserts get affected during the ALTER process? Do they wait until the lock is released? Is ther...
What happens to an insert when a mysql(innoDB) table is being altered(locked)?
dba
2017-06-16T09:43:49.360
[ { "message": "The SQL standard prescribes a rather large vocabulary; on top of this, RDBMSs implement their own constructs. Then they add hundreds of function names, internal and user-facing. On top of that, users go and define schema(ta)s, tables, indexes, custom functions, types, whatnot. Now, when I want to,...
Possible to get comprehensive view on all defined names in PostgreSQL?
dba
2017-06-16T15:50:37.780
[ { "message": "I am working on a system where we are pulling records from a replication server and need to know when changes have occurred.We would like to not have to touch the original server and only read from it, including not being allowed to enable change tracking. Can this be done?If need be, we will sim...
Is it possible to have change tracking ONLY on a replication server, not original?
dba
2017-06-16T20:55:42.580
[ { "message": "I have a rather challenging requirement that I think I have designed correctly but am unsure as it violates a data normalization edict.I am acquiring data from sensors at with a frequency of about 2 mins per sensor but there are many sensors (thousands). Most of the time the user wants to see how...
Data nomalization and table column counts
dba
2017-06-17T16:12:37.483
[ { "message": "When it comes to updating a row, many ORM tools issue an UPDATE statement that sets <a href=\"https://vladmihalcea.com/2016/10/11/how-to-update-only-a-subset-of-entity-attributes-using-jpa-and-hibernate/\" rel=\"noreferrer\">every column associated to that particular entity. The advantage is that ...
What's the overhead of updating all columns, even the ones that haven't changed
dba
2017-06-18T16:32:20.427
[ { "message": "while restoring the User DB from primary to secondary replica through query in cmd prompt and got following error message<blockquote> Msg 262, Level 14, State 1, CREATE DATABASE permission denied in database 'master'. RESTORE LOG is terminating abnormally.Msg 3013, Level 16, State 1, RESTORE L...
Permission issue on restore of the db from primary to secondary
dba
2017-06-19T10:40:21.150
[ { "message": "<a href=\"https://docs.mongodb.com/manual/reference/database-profiler/#system.profile.op\" rel=\"nofollow noreferrer\">According to documentation <code>count</code> and <code>distinct</code> queries should result in <code>op</code> = <code>count</code> and <code>op</code> = <code>distinct</code> i...
Why `distinct` and `count` operations generate `"op": "command"` in system.profile
dba
2017-06-19T12:16:47.090
[ { "message": "I've got a parent table of trainings and a child table of trainingattendees.That is a training can be attended by multiple attendees.I have a bit field in my trainingattendee table called <code>Deleted</code> that has a default value of (0). That is the record is not deleted. This value can chan...
Soft delete field causes left join not to return my "left" side data
dba
2017-06-19T15:08:32.283
[ { "message": "Is it possible to have a stored procedure send an email after it executes successfully. I have an alert account set up but dont know how to create a trigger after the procedure completes. very new here", "role": "user" }, { "message": "There are a number of ways to do this.Edit your SP...
SQL Server 2016- send automatic email after store proceedure executes
dba
2017-06-19T18:50:35.707
[ { "message": "I need to run code when a database/catalog in a Postgres cluster comes online, before any client has connected. Specifically I need to do some cleanup such as dropping/truncating a particular table. Is there a place for my code to be automatically run with a guarantee it will finish before any inc...
Hook to run code when Postgres DB launches
dba
2017-06-19T23:01:06.603
[ { "message": "I want to benchmark some Mongodb queries by calculating their execution time but I could not find a way to do so without caching : The first time I execute a query it takes a decent amount of time and the second time I execute the same query it is extremely faster which means it was due to caching...
Benchmarking Mongodb Queries Without cache
dba
2017-06-20T09:00:17.613
[ { "message": "I can't find a solution to the following problem.Assuming I have 2 tables:Table 1:<pre><code>Name | Age Nick | 52 Adam | 52 Monica | 40</code></pre>Table 2:<pre><code>Name | Task | Value | DoneNick | Clean | 010000 | YNick |...
Return next row that meets condition
dba
2017-06-20T10:48:15.587
[ { "message": "I'm sorry if this question breaks the rules of DBA StackExchange. I'm not sure if it is allowed in here.I am planning to lead a basic SQL Server training for my coworkers. The course should include some basic information about relational databases and the SQL querying. This is why I'm looking for ...
SQL Server training materials
dba
2017-06-20T12:12:29.920
[ { "message": "In preparation for a migration project we are trying to identify any queries that select data across databases.This can be of the form:<pre><code>SELECT fieldA, fieldBFROM dbo.TableA aJOIN DatabaseB.dbo.TableB b ON b.ID = a.ID</code></pre>or <pre><code>DECLARE @resultFromDatabaseB VARCHAR(50)SELEC...
How to identify cross-database queries in SQL Server
dba
2017-06-20T13:47:05.117
[ { "message": "I am looking for a schematic diagram of an existing database.More precisely, I wan't to re-create the database model / schematics / the Entity Relationship Diagram (ERD) showing all the links between the tables of this existing database in MYSQL,I am using MYSQL workbench as an IDE,does it have da...
how to get a schematic diagram/layout of the an existing database
dba
2017-06-20T14:09:53.847
[ { "message": "I have designed a schema and generated a few SQL queries. I'm using PostgreSQL. For example:<pre><code>CREATE TABLE train ( train_code SERIAL PRIMARY KEY, name TEXT NOT NULL); CREATE TABLE journey ( journey_id SERIAL PRIMARY KEY, int INTEGER, train_code REFERENCES train(train_code)); CREATE ...
Converting SQL to Relational Algebra / Calculus
dba
2017-06-20T14:48:23.140
[ { "message": "I have a trigger on a sql azure table I am trying to set up. Bear with me as this is one of my first triggers.This trigger is supposed to track all changes to the table in an audit table.As I understand, you can only use temporary tables in SQL azure if you specifically create them. <a href=\"htt...
sql azure: trigger error when inserting into temp table from inserted table
dba
2017-06-20T23:30:58.487
[ { "message": "\"count\" : 1552400, \"size\" : 1571028800.0, \"avgObjSize\" : 1012, \"storageSize\" : 229552128,from my understanding of the above stats, \"avgObjSize\" gives the size of a document in the collection and \"size\" gives the sum size of all the documents(no index size included) in the collection. b...
why the “size” field of a collection stat is larger than “storageSize” or totalSize of a collection in mongodb. “count” : 1552400
dba
2017-06-21T06:50:27.477
[ { "message": "I need to associate customers' order with their \"level\" (Silver, Gold, etc.) when they placed the order:<pre><code>CRM server::CRM db::CRM table----------CustomerID PreviousLevel NewLevel NewLevelGrantedOnOrder server::Order db::Order table----------OrderID CustomerID OrderPlacedO...
Optimize SSIS package for fewer queries
dba
2017-06-21T13:56:09.860
[ { "message": "I would like to check if a day is missing during the current month in my result set.The table looks like this. <pre><code>date balance2017-06-01 404.662017-06-03 392.412017-06-07 295.412017-06-10 275.412017-06-13 155.242017-06-15 ...
Postgres: compare the dates in rows and find the difference
dba
2017-06-22T08:30:59.857