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": "There is a statement in the MongoDb documentation:<blockquote> You cannot use Hashed Sharding when sharding the chunks collection.</blockquote>It does not say that, but I guess it means that I can only use ranged sharding. But it seems VERY inefficient. In fact, they suggest that the shard key sh...
GridFS: why can't I shard chunks with a hashed key?
dba
2017-11-08T07:18:38.550
[ { "message": "I have a simple table which holds GPS data for various vehicles with 30 million rows.<pre><code> Column | Type | Modifiers | Storage | Stats target | Description------------------------+-----------------------------+-----------+----------+--------------+----...
Postgresql 9.3 GROUP BY on an indexed column in 30m rows table taking a long time
dba
2017-11-08T13:00:31.910
[ { "message": "I see that the Point type is made to store geometric coordinates, however I don't see what problem it is trying to solve, or what advantages it offers over simply using two numerical columns. It's 16 bytes, so is it just an abstraction for two 8 byte floats? Or is it a string containing some kind ...
GIS Point or discrete longitude and latitude columns?
dba
2017-11-08T22:55:08.103
[ { "message": "I am trying to create statistics on a table that already exists. I kept getting this error : The provided statistics steam is corrupt on some of the stats i am trying to create, but not all. Why does this happen and how do I fix it?Please helpThis is one of my stats query just for information:<pre...
Sql server - The provided statistics stream is corrupt
dba
2017-11-09T04:27:31.520
[ { "message": "I am trying to create statistics on a table that already exists. I kept getting this error : The provided statistics steam is corrupt on some of the stats i am trying to create, but not all. Why does this happen and how do I fix it?Please helpThis is one of my stats query just for information:<pre...
Sql server - The provided statistics stream is corrupt
dba
2017-11-09T04:27:31.520
[ { "message": "I have imported a copy of the <a href=\"https://lite.ip2location.com/database/ip-country-region-city-latitude-longitude-zipcode-timezone\" rel=\"nofollow noreferrer\">ip2location_db11 lite database, which contains 3,319,097 rows, and I am looking to optimize a numeric range query, where the low an...
Slow query in PostgreSQL selecting a single row from between a range defined in two columns
dba
2017-11-09T14:03:50.917
[ { "message": "I'm using PostgreSQL 9.6. I have a materialized view to support full-text search across two tables, which I'll call <code>posts</code> and <code>tags</code>. The tables are infrequently updated and frequently searched.I'm trying to find a good strategy to run <code>REFRESH MATERIALIZED VIEW post_s...
Trigger to update a materialized view once after relevant transaction?
dba
2017-11-09T16:37:05.697
[ { "message": "In my organization we have several SQL Server 2016 Enterprise licenses in use. None of them are running SSIS. Since they are not in use, could I install just SSIS 2016 on a separate server and still be covered under the original enterprise license?", "role": "user" }, { "message": "Y...
SSIS Standalone Installation
dba
2017-11-09T18:38:33.580
[ { "message": "I am supporting a customer of ours who has an enterprise edition of our web application living on virtualized servers at their location. They have 3 web servers and 1 DB server. All 4 servers are virtualized with vCenter and have Windows Server 2008 R2 installed.The DB server is running SQL Server...
SQL Server 2008 R2 Performance Degradation - High Lazy writes/sec and free list stalls/sec
dba
2017-11-09T19:53:47.737
[ { "message": "I'm trying to troubleshoot a complex deadlock issue.There are 2 separate processes (service and agent job) which often concurrently execute the same SP but with different @BatchID parameters. This SP is called within an explicit BEGIN TRAN. There are 30 different Insert/Update statements within th...
SQL Deadlock graph - Find exact statement holding the lock and the time it started
dba
2017-11-10T05:42:35.623
[ { "message": "I have two tables named \"Visit\" and \"VisitMovement\" and one Visit can contain many VisitMovements. Within my query I need to join to the latest record for the Visit in VisitMovement so I can get back the latest VisitMovement details. To do this I have a view like this that I join to:<pre><code...
How to best handle MAX within a query/view
dba
2017-11-11T00:56:50.860
[ { "message": "I have to design and implement a database on the study course. I want to make sure that my scheme is correct. I've created a model company and a system which needs a database. A little background about the database: The database is designed for the company who test applications for external client...
Please review my logical data model
dba
2017-11-12T10:05:00.490
[ { "message": "Use case: A measurement creates a given number of images. For each image we need to store a small set of quality indicators (floats, doubles) along with an image integer [1 ...N], a timestamp and one or two foreign key values. This should then be plotted in \"real time\" in a web application (PHP)...
What is the optimal solution for storing real time time-series in MariaDB / MySQL?
dba
2017-11-13T11:24:40.787
[ { "message": "I want to change the FileGroup of a table for FG01 to FG03 . but in properties of table there is the Regular Data Space Specification and Text/Image Filegroup which have the list of FileGroups, what are the differences?", "role": "user" }, { "message": "Regular data is <code>in-row</c...
Regular Data Space Specification vs Text/Image Filegroup
dba
2017-11-13T14:16:54.970
[ { "message": "How is tsrange stored in binary?For example create table<pre><code>CREATE TABLE public.test (t tsrange);INSERT INTO test VALUES ('[2010-01-01 14:30, 2010-01-01 15:30)');INSERT INTO test VALUES ('[2011-01-01 14:31, 2015-11-01 15:30)');INSERT INTO test VALUES ('[2017-01-01 14:31, 2018-11-01 15:30)')...
Parsing COPY's binary format to access a tsrange
dba
2017-11-13T15:41:42.603
[ { "message": "I have 3 Tables like this: Master: PK: SPID<pre><code>SPID| ProjectID|DesignMix|ProjectType|Date |ContentType 1 |123 |AB-12 |New Proj |1/1/2015|CT_1 2 |145 |AR-13 |New Proj |2/1/2015|CT_2 3 |423 |AB-13 |New Proj |1/1/2015|CT_3 </code></pre>Details: PK: ...
Joining multiple tables with complicated rquirements
dba
2017-11-13T16:54:14.027
[ { "message": "If I have a query:<pre><code>SELECT * FROM AINNER JOIN B ON B.ID = A.IDINNER JOIN C ON C.ID = B.ID</code></pre>Would that return a different result to this query?<pre><code>SELECT * FROM AINNER JOIN B ON B.ID = A.IDINNER JOIN C ON C.ID = A.ID</code></pre>It seems to me that in the first query I wo...
What intersection do multiple inner joins return?
dba
2017-11-14T10:05:37.973
[ { "message": "I'm working with dimensional modelling for the first time, trying to build a data warehouse that pulls in data from an OLTP database, and I'm having some trouble figuring out what to do with this type of scenario. The database tracks donations into a foundation. I'd like to have a fact table such ...
Dealing with different types in a fact table
dba
2017-11-14T18:23:20.913
[ { "message": "I'm trying to create a lost time report in SSRS. I found a script that gives me what I need for a single date range, but I need this for multiple dates, and I need the total for the range.So if I have 6 date ranges, I just need the total for the month/year combination and type combination (either ...
Days in between two dates group by month
dba
2017-11-16T00:56:12.810
[ { "message": "I have following code developing 2 XML files but I would like them to be in one file itself with multiple Organization tag.<pre><code>SELECT LTRIM(RTRIM(c1.cptname)) as \"orgHeader/orgCode\",LTRIM(RTRIM(c1.cptname)) as \"orgHeader/longName\",LTRIM(RTRIM(c1.cptname)) as \"orgHeader/shortName\",'Bra...
Merge two XML outputs to one from SQL query
dba
2017-11-16T20:36:16.467
[ { "message": "while restarting the mongodb instance the directory mongodb in /var/run is deleting after restarting the instance the again i am creating the directory in /var/run and restarting the service whats the solution to it not to delete the directory after restarting the instance", "role": "user" }...
Regarding restarting instance mongodb
dba
2017-11-17T07:08:03.637
[ { "message": "I am working on creating an AG on SQL Server 2017 Standard and Windows Server 2016. I have created the failover cluster using a file share witness and everything checks out OK with the cluster. The only issue or warnings I get are related to only using 1 NIC for each server (These are VM's with ...
SQL 2017 Standard Availability Group
dba
2017-11-17T18:11:14.407
[ { "message": "I have a 3-node FCI: 1 primary / 1 secondary co-located in same data center on same subnet, and 1 secondary in a DR data center on another subnet. Periodically, the virtual IP (VIP) for the AG name flips to the DR site and clients can't connect the Primary site. The quick fix is to remove the l...
Multi-Subnet AG - DNS flips to secondary IP
dba
2017-11-17T19:31:47.337
[ { "message": "I have a need to see a trend of data for \"month to date\" So I want to pull the 1st x number of days of each month for the last 14 months, and the n aggregate this.My data has approximately 10k data points each daySo far I have only been able to figure out how to do this by writing a double whil...
How to aggregate timeseries several months long - when I only want a portion of each month
dba
2017-11-18T12:08:29.643
[ { "message": "I commented out the LIMIT statement because it's not working. All selected rows are always returned, no matter what.Code:<pre><code> $sql = \"SELECT riderUid AS `rider`, ( \"; $sql .= \"SELECT SUM( mileage ) \"; $sql .= \"FROM `mileage` \"; if (isset($ytd) &amp;&amp; $ytd == 1) { $sql .= \"W...
Why isn't LIMIT working here?
dba
2017-11-18T21:42:47.737
[ { "message": "Currently we have a 4 shard cluster Can you give me the procedure to check the orphaned documents in our clusterAnd can you provide me the procedure to delete the orphaned documents in the clusterPlease find the below screen shot of our cluster<a href=\"https://i.stack.imgur.com/klTpS.png\" rel=\"...
Clean up orphaned documents in MongoDB
dba
2017-11-20T07:34:58.163
[ { "message": "Here's the error message I'm getting today when I attempt to log in to my localhost PosgreSQL databases using <code>psql</code>:<pre><code>psql: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket \"/tmp/.s.PGSQ...
Homebrew installed PostgreSQL could not connect, database files are incompatible with server
dba
2017-11-20T15:02:03.127
[ { "message": "Here's the error message I'm getting today when I attempt to log in to my localhost PosgreSQL databases using <code>psql</code>:<pre><code>psql: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket \"/tmp/.s.PGSQ...
Homebrew installed PostgreSQL could not connect, database files are incompatible with server
dba
2017-11-20T15:02:03.127
[ { "message": "I feel like I may of made a mistake with my database design.At the moment I have 73182 tables, 4 days ago I had 72236, and just 2 months ago we only had about 20k tables - so our growth spiked.Essentially, each customer has their own set of tables for the CRM, these tables are almost all very simi...
MySQL - Design + Optimization Question
dba
2017-11-20T22:15:32.040
[ { "message": "We are trying to create a query for the following table : <pre><code> CREATE TABLE `Action` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `vendor_Id` int(10) unsigned DEFAULT NULL, `name` varchar(60) NOT NULL, `assigned_To` varchar(40) DEFAULT NULL, `updated_At` datetime(3) NOT NULL, `com...
Cursor Based Pagination for Timestamp field with non-unique values
dba
2017-11-22T06:14:08.100
[ { "message": "We've got a single table where we store Events.The table has an index on it's primary keyAssuming we're only doing simple <code>SELECT</code>s or <code>INSERT</code>s on that table - would the retrieval or insertion time get noticeably* slower as more and more rows are added?My (very crude) unders...
Does a table with an index ever slow down?
dba
2017-11-22T12:16:34.627
[ { "message": "Lately I have been facing failed connection errors mainly due to servers using NTLM Authentication. In our environment the servers have a combination of ntlm and kerberoos. My question is If i ask my Domain admin to manually register all the service accounts to use the kerberoos instead of ntlm au...
Sql servers are using Kerberros and NTLM Authentication
dba
2017-11-22T14:02:39.380
[ { "message": "Here are the columns of concern for a table describing tasks: Org_ID Task_IDTask_property_columnsThe only requirement for <code>Task_ID</code> is that it is unique per every <code>Org_ID</code>, however I would prefer not handle that programatically and that it be auto incremented. The requirement...
Mariadb clustering Index design question
dba
2017-11-23T15:25:35.537
[ { "message": "I'm trying to add a counter to one of my tables. So far I have these tables<pre><code>Heroes {hero_id, hero_name, villain_id, team_id}Villains {villain_id, villain_name, team_id}Teams {team_id, team_name, no_of_members}</code></pre>I want to create a trigger that updates the member count whenever ...
SQL - Is it possible to have a Trigger statement with a WHERE clause that is an equality measure
dba
2017-11-23T20:22:32.293
[ { "message": "I am trying to figure out points reside inside an rectangular area (envelope). I am having a little bit difficulty understanding performance implications of using <code>&amp;&amp;</code> operator compared to <code>ST_Intersect</code>.However I think I explained my own question while trying to form...
&& vs ST_Intersects performance
dba
2017-11-24T15:59:52.693
[ { "message": "using Postgres 9.6, pgAdmin 4 (for running the queries) on Windows 10 64-bit with Intel Core i7-6700 CPU @ 3.40GHz, 16GB RAM, 1 TB C drive HDD , 2 TB D drive HDD. Postgres data is stored in D driveI'm using Postgres to process some dataset that I receive in csv format- the steps involved are as fo...
improve postgres query perfromance on windows with billions of records, TB data size
dba
2017-11-25T09:23:03.203
[ { "message": "I have a <code>road_condition</code> table in Oracle 12c:<pre><code>create table road_condition ( cond_id number(5,0), road_id number(5,0), cond_date date, condition number(5,0));insert into road_condition (cond_id,road_id,cond_date,condition)values (1,100,to_date('01-NOV-84','DD-MON-R...
Interpolate dates along a line
dba
2017-11-25T22:17:54.303
[ { "message": "I am trying to set up a database environment with Ubuntu and PostgreSQL (I didn't want to use RDS because I'm a Ubuntu person). I looked at description for the <code>R3</code> instance type:<blockquote> Use Cases High performance databases, data mining &amp; analysis, in-memory databases, dis...
How to take advantage of AWS EC2 instance store (SSD) in a database environment?
dba
2017-11-25T22:48:36.143
[ { "message": "The CPU utilization is going to 100% regularly, and when I check SP_who2, it is showing around 20000 sessions, most of them are sleeping (also utilizing the CPU).<br>I think the CPU load is related to the sleeping sessionsThe application name is showing as Microsoft JDBC. Most of the sessions are ...
More than 15000 sleeping sessions in SQL Server 2014
dba
2017-11-27T04:22:46.717
[ { "message": "what would be your preferred method to perform backup on quite active 500G+ MariaDB Galera Cluster?Using mariabackup/innobackupex (fork of Percona Xtrabackup) with throttle. You must think about FLUSH TABLES WITH READ LOCK which can cause problems to whole cluster if lock lasts to long. When using...
How to perform backup on quite active 500G+ MariaDB Galera Cluster?
dba
2017-11-27T09:41:00.090
[ { "message": "In our games we have a quartely league system. Every 3 months, the current season ends and all scorings of the current quarter are archived into a table called archive_league. Each entry represents a user and his score for a given league quarter. It comes with the following fields: <pre><code>id -...
MySQL: Assign rankings for a large table of results
dba
2017-11-27T16:29:28.660
[ { "message": "While trying to clean <code>cleanupOrphaned</code> in my cluster <a href=\"https://i.stack.imgur.com/ygfcL.png\" rel=\"nofollow noreferrer\"> I am getting this error.", "role": "user" }, { "message": "OK.. Step 1. database and collection must be originally created (or sharded) thru mo...
Clean up orphaned documents in MongoDB error
dba
2017-11-27T18:49:12.790
[ { "message": "I'm trying to set my general log file to a fifo named pipe and am getting an error<pre><code>$ sudo mkfifo -m 0666 general.fifomysql&gt; set global general_log_file='/var/log/mysql/dradis/general.fifo';ERROR 1231 (42000): Variable 'general_log_file' can't be set to the value of '/var/log/mysql/dra...
Unable to set general log to fifo pipe
dba
2017-11-27T20:31:08.000
[ { "message": "I just had a situation where I had to include a column in an index. This required dropping the index, and recreating it. This got me thinking, surely that's a lot of unnecessary work.Say I had instead created the new index first, then dropped the old one. Let's also assume that I have some way of ...
Can SQL use an index while creating another?
dba
2017-11-27T20:56:11.983
[ { "message": "I have 3 tables that are currently defined as:<a href=\"https://i.stack.imgur.com/CUsRE.png\" rel=\"nofollow noreferrer\">Is this the best way, or should I use an associative table?I put the relationships backwards, 1 group can contain many users and many students. There is no other relationship ...
Define relationships for 3 tables
dba
2017-11-28T00:06:04.600
[ { "message": "I was trying to use the query below to update the <code>ORDERS</code> table by making the <code>O_TOTALPRICE</code> column up-to-date when the <code>LINEITEM</code> table is modified. And I was using a standard TPC-H database.<pre><code>UPDATE ORDERS O, LINEITEM L SET O.O_TOTALPRICE = SUM(L.L_...
Update a table using summed values from another table in MySQL/mariaDB
dba
2017-11-29T03:36:11.657
[ { "message": "Side By Side Upgrade and Migration from 2008 to 2016Old Server Name Test1New Server Name Test1Default Instance Test 1My question is when the new server be named as the old one 'Test1\" and it will try to register the dns while the old server is online wont be there a problem as the name is already...
Side By Side Upgrade and Migration from 2008 to 2016
dba
2017-11-29T15:45:10.517
[ { "message": "I have setup up SQL Server Change Tracking on a table t1 on MS SQL2008R2. Within a transaction, I insert a row into it and update it 'n' times. When I examine the rowcounts in the change tracking tables, it shows 'n' number of rows whereas the syscommitab shows just 1 row. Since the change trackin...
Why does the MS SQL Server change tracking table store all DML operations that occurred within the transactiton?
dba
2017-11-30T06:52:25.017
[ { "message": "I have a select query that should return a result with about 200 rows from 3 tables:<code>wb_mod_deposit_out</code> - 700.000 rows<code>wb_mod_deposit</code> - 100.000 rows<code>from_generale_java</code> - 1200 rows.The query is:<pre><code>SELECT DATE(a.created) AS DATA_MANCANTE, a.stagione, ...
Query runs for too long
dba
2017-11-30T07:15:14.593
[ { "message": "Can I use the hostname of the server in a PostgreSQL <code>SELECT</code> statement? The following may be close but apparently does not quite work:<pre><code>\\set x \\! hostnameselect :x;</code></pre>This is for PostgreSQL 9.6 on Debian.", "role": "user" }, { "message": "PostgreSQL has...
How do I get the remote hostname of the server?
dba
2017-11-30T07:25:18.130
[ { "message": "Can I use the hostname of the server in a PostgreSQL <code>SELECT</code> statement? The following may be close but apparently does not quite work:<pre><code>\\set x \\! hostnameselect :x;</code></pre>This is for PostgreSQL 9.6 on Debian.", "role": "user" }, { "message": "I don't think ...
How do I get the remote hostname of the server?
dba
2017-11-30T07:25:18.130
[ { "message": "The idea is to get all data for a time frame We want to do a query that shows everything related with a employee for this month. There is a total of 7 queries to merge into one pivot result.<pre><code>General where date clause as some tables consists of two dates start and endsstart &gt;= this ...
Better way to rewrite conditional sum - Query merging
dba
2017-11-30T12:48:45.503
[ { "message": "We have a main analytics SP that calls 100 other sub SPs, all of which act upon the same set of data (Claims), check it for some business rules, and output discrepancies.The SPs need not all be run sequentially, they can be broken out into sections, which are dependent on previous sections (sequen...
SQL Parallel Stored Procedure execution using CLR - Performance
dba
2017-12-01T04:41:55.767
[ { "message": "I'm developing with CodeIgniter and I have the following problem:Let's suposse that I have the following table:<pre><code>| id | employee | job | date ||----+--------------+-------------+------------|| 1 | John | sysadmin | 2017-12-01 || 2 | Charles | programmer...
Query that only get one result per field
dba
2017-12-01T10:24:14.860
[ { "message": "My query looks like this<pre><code>select employees.PK_worker, concat(employees.name,' ',employees.surname) AS name, (select coalesce(sum(employees_to_hand.cost),0) from employees_to_hand where employees_to_hand.PK_worker = employees.PK_worker ...
Alias summing in mysql
dba
2017-12-02T10:39:38.040
[ { "message": "For example, a news website might have \"categories\" such as Politics, Business, Entertainment, Sports, Lifestyle, Tech, Science, Health, ... etc. Each article belongs to only one category, but can have multiple \"tags\". Tags are just like hashtags we see on social media and can be very detailed...
What's the best database design for implementing categories and tags?
dba
2017-12-02T12:33:16.977
[ { "message": "The below SQL query runs in 2s:<pre><code>SELECT *FROM fb_name INNER JOIN fb_kg ON mid = subject_mid WHERE LOWER(alias) = LOWER('Polaski') AND fb_kg.relation = 'location/location/containedby'</code></pre>The below SQL query runs in 2ms:<pre><code>SELECT *FROM fb_nam...
Functional Index LOWER PostgreSQL not working
dba
2017-12-02T22:20:13.430
[ { "message": "When i upload data from php post forums \"हिन्दी\" language, changed into \"हरिà\" in database but looking correct in webpage,andwhen i upload data through phpmyAdmin from csv file \"हिन्दी\" changed into \"???????\" in webpage but looking correct in mysql database,i ran a query,<pre><code>...
UTF-8: showing correct in database, but not in webpage
dba
2017-12-03T11:53:24.287
[ { "message": "I am trying to set up a linked server on Server A to Server B using windows authentication.Using SSMS, I can connect to both Server A (from ServerB) and Server B (From Server A) using Windows Authentication and the username <code>DOMAIN\\User</code>. Additionally, when I log into Server A from Ser...
Creating Linked Server - Impersonation of Windows Authentication
dba
2017-12-04T16:48:09.643
[ { "message": "We've got a SQL Server database powering our SAAS web app. It's a SQL Azure database, hosted on S3 Standard plan (100 DTU units - pretty suficient for what we need).Our DB indexes fragment really quickly, to the point that after 3-4 days, a lot of our more used tables are usually over 40% fragment...
Rebuilding fragmented indexes on SQL Server
dba
2017-12-05T12:08:13.270
[ { "message": "I have a database with the following tables : <pre><code>CREATE TABLE [Document]( [IdDocument] [int] NOT NULL, [DocumentType] [int] NOT NULL CONSTRAINT PK_Document PRIMARY KEY CLUSTERED (IdDocument))CREATE TABLE [ExternalKey]( [IdExternalKey] [int] NOT NULL, [RefDocument] [int] NOT ...
SQL Query optimization - Long running query
dba
2017-12-05T14:58:09.053
[ { "message": "I’ve searched and read wide about the good practices of configuring swap space for Oracle Database installation. I am aware that for 1-2GB RAM, swap has to be 1.5x. For between 2GB and 8GB, swap needs to be equal to SGA. Above 8GB, swap will be twice SGA size (I stand to be corrected).However, jus...
SGA size vs SWAP space in Oracle RAC
dba
2017-12-05T17:23:39.283
[ { "message": "I'm trying to learn more about the \"foreign key references check\" query plan operator introduced in SQL Server 2016. There's not a lot of information about it out there. Microsoft announced it <a href=\"https://blogs.msdn.microsoft.com/sqlserverstorageengine/2016/05/23/query-optimizer-additions-...
What is a "Partial Matching Index"?
dba
2017-12-06T13:24:53.503
[ { "message": "I have an insert-only PostgreSQL database with a Book table, a Page table and an Element table.Books can have multiple pages and pages can have multiple elements.The database is insert-only because any time a page is modified, a new version of that page is created in a new record for auditing reas...
How to efficiently clone database records together with all child elements
dba
2017-12-06T17:54:51.160
[ { "message": "I need to properly format some European addresses.One of the steps is to capitalize the first letter, but avoiding some specific words, like 'on', 'upon', 'von', 'van', 'di', 'in', 'sul'.Therefore, although my skills are scarce, I thought it was a good idea to use a RegEx-based function.After some...
Capitalize first letter with exceptions
dba
2017-12-07T09:25:55.867
[ { "message": "Hy everyone, I'm trying to create user which can just read from database but when I try to do that and insert something into the database I succeed: <a href=\"https://i.stack.imgur.com/K6gAr.png\" rel=\"nofollow noreferrer\">", "role": "user" }, { "message": "<pre><code>rs0:PRIMARY&gt;...
How to create role "read" in MongoDB?
dba
2017-12-07T09:49:08.027
[ { "message": "I am currently granting permissions to a service account on a database. I want to ensure if the granting <code>db_datareader</code> and <code>db_datawriter</code> database roles is the same as my grant command.Adding service account to <code>db_datareader</code> and <code>db_datawriter</code> data...
Granting permission to the service account
dba
2017-12-08T16:20:21.443
[ { "message": "I have three columns f1, f2 and f3<pre><code>f1 f2 f3 1 3 55 7 3...</code></pre>My goal is to select those entries where the relationship of f1:f2:f3 is roughly(+-2) number1:number2:number3Example:<pre><code>SELECT those rows where the relationship is roughly 5:7:4 -&gt; Result 5 7 3.</c...
Select those entries where the relationship of the columns f1:f2:f3 is roughly number1:number2:number3
dba
2017-12-09T17:18:52.157
[ { "message": "I have a front end MS Access running through a backend MySQL database via ODBC, I recently moved MySQL database from a local LAN server to a hosted WAN server on Amazon RDS. Now all of my queries are running very slow. By searching online I found the best way is to rewrite the queries in pass thr...
Running MS Access queries for WAN hosted mySQL database
dba
2017-12-10T15:44:58.583
[ { "message": "I have an issue where I have renamed the database for which my cube deploys to from, say, <code>SalesAndStuff</code> to <code>Sale</code>. This has been no issue, I have changed the database name in Management Studios etc. My issue is that when I try to deploy my cube now from Visual Studio I get ...
Deploying a cube where database name has been changed
dba
2017-12-10T16:03:45.807
[ { "message": "I tried the following steps to upgrade CHARSET to utf8mb4 and to connect it to the existing backend server.ALTER TABLE users CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;update the DB connection parameters.<code>\"user:pass@tcp(server:3306)/mydbcharset=utf8mb4&amp;collation=utf8mb4_...
convert default charset utf8 tables to utf8mb4 mysql 5.7.17
dba
2017-12-11T08:29:44.103
[ { "message": "Is it possible to configure SQL Server user so that he doesn't have access to DDL statements but has access to run <code>TRUNCATE TABLE</code> commands. I know that behind the scenes it's a DDL.I wasn't able to find this on search engines.", "role": "user" }, { "message": "I would sugg...
SQL Server TRUNCATE TABLE permissions
dba
2017-12-12T13:08:13.533
[ { "message": "Is there a way to log SQL warnings on a MariaDB server (10.2)?For example, I would like to be able to record (in a log file) this type of warning (strict mode is disabled in this example):<pre><code>MariaDB [mysql]&gt; select now() = 1;+-----------+| now() = 1 |+-----------+| 0 |+---------...
Logging SQL warnings in MariaDB
dba
2017-12-12T16:25:56.260
[ { "message": "I need to create a Stored Procedure that will take parameters of type List. For example :<pre><code>Select * From TableWhere State in @StateList or Lob in @LobList or Company in @CompanyList</code></pre>The parameters @StateList, @LobList and @CompanyList will contain string data like : ...
How to create SQL Stored Procedure with parameters of type List<string>
dba
2017-12-12T18:53:00.267
[ { "message": "We have two standalone servers with local storage. Based on our needs we have determined that we need to use AlwaysOn failover cluster instances. Can we use the \"<a href=\"https://docs.microsoft.com/en-us/windows-server/storage/storage-replica/storage-replica-overview\" rel=\"nofollow noreferrer\...
Use Windows 2016 Storage Replica for SQL Server failover cluster instance
dba
2017-12-13T15:57:29.413
[ { "message": "I have a 2-node cluster on SQL Server 2016 Standard with failover clustering configured with Dynamic Quorum.There is one thing that made me confused: do we really need a Witness in this case?Since I've enabled Dynamic Quorum, my cluster will not go down if one of the nodes goes down. But some guys...
In 2-node cluster using failover with Dynamic Quorum, is Witness needed?
dba
2017-12-14T01:04:18.307
[ { "message": "In course of a change I migrated a database from Oracle 12.1 to MSSQL 2016.Since the two databases handle date differently, I now need to move the fields from char(26) to datetime2.Output format is e.g. <code>2011-05-30-13.06.56.824000</code> What I need is Type 21: <code>2016-04-01 10:20:56.89500...
Converting from char(26) to datetime2
dba
2017-12-14T09:35:54.940
[ { "message": "We are currently running a Python web app querying a SQL MariaDB (through SQLAlchemy). Unfortunately we have run into some hard limitations of MariaDB (number of joins are <a href=\"https://dev.mysql.com/doc/refman/5.7/en/joins-limits.html\" rel=\"nofollow noreferrer\">limited to 61) and are looki...
Is our use case suitable for a NoSQL Database solution?
dba
2017-12-14T09:40:54.687
[ { "message": "I have a short question concerning my database size. I need to insert data in a database. Before the insert, some calculations need to be done. The point is: from 50 mb plain data (~700,000 lines), this results in 600 mb db size. This is a factor 12! I am sure I am doing something wrong here. Coul...
Why is my database 12 times bigger than inserted data?
dba
2017-12-14T12:57:01.867
[ { "message": "Please could someone help me construct an SQL query for the following...I need to update the value 'ucr' in an existing table (db_table_1) with the 'ucr' uploaded to a temporary table (dummy_table) by matching the email address up with the email address that actually exists in a different table al...
SQL query to update value based on email address in different table joined by id
dba
2017-12-14T16:14:44.527
[ { "message": "Trying to sum every X rows with no common group by parent<pre><code>declare @temp table(Row_ID int, amt DECIMAL(18,2))insert into @temp values(1, 20)insert into @temp values(2, 24)insert into @temp values(3, 20)insert into @temp values(4, 15)insert into @temp values(5, 15)</code></pre>If X rows is...
Sum every X rows with no common group by parent
dba
2017-12-15T13:28:30.657
[ { "message": "In a conference management system, a user can create one ore many conferences. The user that creates a conference is the conference organizer. But a user can also register in a conference.So there should be 3 entities: Conference, User, Organizer<blockquote> Conference: id, name, description ...
a user, that is a organizer can create conferences, but can also participante in conferences
dba
2017-12-15T23:48:32.460
[ { "message": "I have a table that I would like as a leader-board for invitations as described below. I would like to create a query that counts the number of duplicate rows in a given month and order in a descending fashion.Reading through some questions, this query seems to work:<pre><code>SELECT COUNT(invite_...
Find most frequent values for a given column
dba
2017-12-16T15:04:10.387
[ { "message": "On trying to install postgres on Ubuntu 14 I am seeing postgres is shutting down. I am seeing the below errors in logs<pre><code>[19043] LOG: listening on IPv4 address \"127.0.0.1\", port 5432[19043] LOG: listening on Unix socket \"/var/run/postgresql/.s.PGSQL.5432\"[19044] LOG: database system...
Postgres 10 shutting down on installation in Ubuntu 14
dba
2017-12-17T03:54:50.943
[ { "message": "In a PostgreSQL 9.6 database, I'm using this sql to get 'application' (field) -> 'tour_id.id' (key and subkey in jsonb field)<pre><code>SELECT * FROM \"payment\" WHERE (\"payment\".\"application\"#&gt;&gt;'{}')::text LIKE '%a43d38d4-9bfb-4ffa-8704-e536f04b0c60%'ORDER BY \"payment\".\"createdAt\" D...
Search subkey inside JSONB
dba
2017-12-18T02:30:40.123
[ { "message": "I have a table <code>payment</code> with a <code>jsonb</code> column <code>application</code>. It contains payments and the total amount for one or more tours. For example, a parent can pay 1000 $ for all his family, e.g. 4 children and his wife. Then one row in <code>payment</code> contains 6 rec...
Index by subkey in jsonb
dba
2017-12-18T05:02:02.130
[ { "message": "I just read about <a href=\"https://www.sqlskills.com/blogs/paul/using-fn_dblog-fn_dump_dblog-and-restoring-with-stopbeforemark-to-an-lsn/\" rel=\"nofollow noreferrer\"><code>fn_dblog</code>, and <code>fn_dump_dblog</code>. I was wondering how do I know what functions like this exist,I'm not the o...
What internal functions are undocumented in SQL Server?
dba
2017-12-19T03:37:58.563
[ { "message": "We had an EC2 instance running PostgreSQL. We created a new EBS volume for our more important DBs and stored them on the new volume by creating new tables spaces and setting their location. The system DBs were left in the default tablespace and location. Unfortunately the instance was accidentally...
Can PosgreSQL databases be restored from physical files?
dba
2017-12-20T14:17:25.920
[ { "message": "I've got <code>(key, value)</code> pairs stored in two different tables - <code>company_settings</code> and <code>branch_settings</code>. A <code>key</code> can exist in none, one or both of the tables.In case the <code>key</code> exists in both tables, I'd like to use the <code>value</code> store...
How to give precedence to rows from one table over matching rows in another?
dba
2017-12-20T19:43:20.923
[ { "message": "I recently have an hdd failure and I try to restore Griffith (<a href=\"https://github.com/micjahn/Griffith\" rel=\"nofollow noreferrer\">https://github.com/micjahn/Griffith) database from a <code>/var/lib/mysql/griffith</code> file copy. My new computer uses a more recent version of MySQL:origina...
cannot recover mysql idb file
dba
2017-12-21T00:27:37.500
[ { "message": "What is the meaning of the <code>principal_id</code> in <code>sys.schemas</code> and when would it ever be different from <code>schema_id</code>?<pre><code>1&gt; SELECT LEFT(name,20), schema_id, principal_id FROM sys.schemas;2&gt; GO schema_id principal_id--------------------...
What is the significance of the principal_id in sys.schemas?
dba
2017-12-22T03:43:55.007
[ { "message": "I often began to fall down mysql. I recorded a large number of requests:<pre><code> 11019 user localhost user 20892 Query Waiting INSERT INTO `wp_options` (`option_name`, `option_value`, `autoload`) VALUES ('_transient_87d68d4b30920f957eff6eac73f31dfd', 'youtube', 'yes') ON DUPLICATE K...
MySQL crashed because of the large number of requests
dba
2017-12-25T11:38:11.460
[ { "message": "Does anyone have a TSQL script that can automatically generate the code necessary to attach ALL existing user databases using the <a href=\"https://docs.microsoft.com/en-us/sql/t-sql/statements/create-database-sql-server-transact-sql\" rel=\"nofollow noreferrer\">CREATE DATABASE FOR ATTACH syntax?...
Generate CREATE DATABASE FOR ATTACH for all existing user databases
dba
2017-12-26T16:51:05.933
[ { "message": "I'm currently studying SQL Server Always Encrypted feature. How can I disable column decryption to \"sa\" if all they have to do is add <code>Column Encryption Setting=enabled</code> in the login's additional login parameters in SQL Server Management Studio?I read articles in Google. They only sai...
Securing Always Encrypted SQL Server from "sa"
dba
2017-12-27T07:32:55.903
[ { "message": "I'm trying to add an assembly to SQL server 2012 but I'm getting the following errors. I've tested the dll and it works fine from C# so don't think it's a code issue. Any suggestions?<pre><code>Msg 6218, Level 16, State 2, Line 6CREATE ASSEMBLY for assembly 'HMDACalculateULICheckDigit' failed bec...
Creating SQL Assembly error Method parent has circular class type parameter constraints
dba
2017-12-27T15:50:17.183
[ { "message": "I want to run mysqldump or basically, anything that lets me easily export / import mysql db from one server into another.Thing is: I want to export production data as staging / integration / demo data. That means, prior to importing the data, all user data must be gone. We had it one time, that th...
Creating Production -> staging flow, how to skip email addresses when doing mysqldump?
dba
2017-12-28T06:43:13.363
[ { "message": "I created a maintenance plan a week ago and it's been executing fine every night. Now the Database Shrink task has stopped working and throws this error:<blockquote> Property Size is not available for Database '[foo]'. This property may not exist for this object, or may not be retrievable due to ...
Database Shrink task fails
dba
2017-12-28T09:13:01.910
[ { "message": "<pre><code>DGMGRL for Linux: Version 12.1.0.2.0 - 64bit ProductionCopyright (c) 2000, 2013, Oracle. All rights reserved.Welcome to DGMGRL, type \"help\" for information.Connected as SYSDBA.DGMGRL&gt; show configurationConfiguration - oradb Protection Mode: MaxPerformance Members: oradb - Pri...
Oracle Data Guard Error
dba
2017-12-28T11:46:24.157
[ { "message": "I'm trying to determine the performance characteristics of citext. In Microsoft SQL Server, the <code>nvarchar(max)</code> has performance hits when there is excessive memory grants required to use it versus something like a <code>varchar(50)</code>. There are other performance hits that come in t...
PostgreSQL performance citext
dba
2017-12-28T20:16:05.140
[ { "message": "I currently have a sharded cluster up and running, and I have noticed that the memory usage of the primary member of each replica set is very high, it is 8GB although I started each member with the following:<pre><code>mongod --auth --bind_ip_all --shardsvr --replSet a --smallfiles --oplogSize 102...
MongoDB Primary Member of Replica Set High Memory Usage
dba
2017-12-29T10:06:52.847