Most Popular
1500 questions
31
votes
5 answers
Is it OK to keep a value which updates in a table?
We are developing a platform for prepaid cards, which basically holds data about cards and their balance, payments, etc.
Up until now we had a Card entity which has a collection of Account entity, and each Account has an Amount, which updates in…
Mithir
- 529
- 5
- 12
31
votes
5 answers
Where can I find the mysql slow log?
Just as the title says, where can I see it ?
Are there any config options for it ( like how many ms would determine if a query is slow or not ) ?
poelinca
- 2,865
- 3
- 21
- 15
31
votes
7 answers
Access denied for user 'root'@'%'
I used to access the root user in MySQL just fine. But recently, I am no longer able to.
I am able to login fine :
mysql -u root -p
Here is the mysql status after login :
mysql> status
--------------
mysql Ver 14.14 Distrib 5.5.28, for…
jules testard
31
votes
2 answers
How To Profile Stored Procedures
I am using SQL Server 2012 and was wondering how to profile stored procedures
For instance can profiler capture each individual SQL statement in a stored procedure, what it is, and how long it takes to run etc?
I am trying to diagnose merge…
peter
- 2,187
- 5
- 19
- 38
31
votes
2 answers
PostgreSQL - insert/update violates foreign key constraints
I am a new one in postgreSQL. I have 3 tables, one table references the other 2 table's primary keys. But I couldn't insert data into the Table3. See the code below :
DROP TABLE Table1 CASCADE;
CREATE TABLE Table1(
"DataID" bigint NOT NULL DEFAULT…
Haseena
- 571
- 3
- 7
- 16
31
votes
3 answers
What are valid usage scenarios for HEAP tables?
I am currently doing some data imports into a legacy system and discovered that this system does not use a single clustered index. A quick Google search introduced me to the concept of HEAP tables and now I am curious in what usage scenarios a HEAP…
marc.d
- 413
- 1
- 4
- 5
31
votes
5 answers
How do I generate a tnsnames.ora file to connect to an Oracle Database?
I have installed Oracle 11g, and I can connect as sysman to the Oracle database, but there is no tnsnames.ora file that I can find.
Do I need to generate the tnsnames.ora file myself? If so, where do I place it? If not, how does Oracle generate it…
user897237
- 413
- 1
- 4
- 7
31
votes
4 answers
Does SQL Server Only Perform Calculations In A SELECT List Once?
Take the following example:
SELECT As ColA,
As ColB,
+ As ColC
FROM TableA
Would CalculationA and CalculationB, each be calculated twice?
Or would the optimizer be clever…
Gravitate
- 421
- 4
- 10
31
votes
1 answer
Self referencing scalar function nesting level exceeded when adding a select
Purpose
When trying to create a test example of a self referencing function, one version fails while another one succeeds.
The only difference being an added SELECT to the function body resulting in a different execution plan for both.
The function…
Randi Vertongen
- 16,393
- 4
- 34
- 61
31
votes
4 answers
Track all modifications to a PostgreSQL table
We have a table which has only roughly 500 rows, but it is very important for us.
I want see all changes which happen to this table. The changes should get tracked with a timestamp.
I don't want the tracking to happen in the application code, since…
guettli
- 1,521
- 5
- 24
- 49
31
votes
3 answers
Character vs Integer primary keys
I'm designing a database with multiple lookup tables containing possible attributes of the main entities. I'm thinking of using a 4 or 5-character key to identify these lookup values rather than an auto-incrementing integer so that when I store…
BenV
- 4,893
- 7
- 39
- 38
31
votes
4 answers
What is a scalable way to simulate HASHBYTES using a SQL CLR scalar function?
As part of our ETL process, we compare rows from staging against the reporting database to figure out if any of the columns have actually changed since the data was last loaded.
The comparison is based on the unique key of the table and some kind of…
Joe Obbish
- 32,165
- 4
- 71
- 151
31
votes
4 answers
Unquoting JSON strings; print JSON strings without quotes
SELECT json_array_elements('["one", "two"]'::json)
gives result
| json_array_elements |
| :------------------ |
| "one" |
| "two" |
I would like to have the same but without the quotes:
one
two
Looks like I can't use…
Maxim Yefremov
- 435
- 1
- 4
- 7
31
votes
5 answers
MySQL console: Ctrl+C driving me nuts
There is something in the MySQL console that drives me nuts. When I hit ctrl+c to cancel the current command being typed, the terminal exits.
In every terminal I know (*nix terminals, Python, PostgreSQL), ctrl+c cancels the current command and…
Adam Matan
- 11,659
- 29
- 80
- 95
31
votes
2 answers
Using source columns in OUTPUT INTO clause of an INSERT statement (SQL Server)
I am writing a batch processing insert statement and would like to use a temp table to keep track of inserted ID's instead of looping through the items myself and calling SCOPE_IDENTITY() for each inserted row.
The data that needs to be inserted has…
Louis Somers
- 563
- 3
- 8
- 16