Most Popular

1500 questions
34
votes
3 answers

varchar(255) or varchar(256)?

Should I use varchar(255) or varchar(256) when designing tables? I've heard one byte is used for the length of column, or to store metadata. Does it matter anymore at this point? I saw some posts on the internet, however they apply to Oracle and…
user129291
34
votes
3 answers

Is the CPU performance relevant for a database server?

This is a purely theoretical question. Let's say I have an application deployed on multiple servers. A load balancer, Multiple/scalable applications servers A (single) database server (for the moment) On the two first parts, I do know what to…
Zenklys
  • 451
  • 1
  • 4
  • 6
34
votes
4 answers

postgres - pg_dump and pg_restore without roles

I'm trying to restore a dump without having the appropriate roles on the receiving database. As mentioned here but also here, you need to have the --no-owner as an option, either in pg_dump or pg_restore or both. I've used the following command line…
Andy K
  • 667
  • 1
  • 9
  • 19
34
votes
2 answers

As a DBA, how would I go about transitioning from Oracle to SQL Server?

I'm an Oracle DBA that also has Sybase experience. What are the major architectural and conceptual differences between the two RDBMS platforms? An answer similar to the SQL Server->Oracle question here would be of most use.
Philᵀᴹ
  • 31,762
  • 10
  • 83
  • 107
34
votes
3 answers

Are Views optimized when I add a WHERE clause to them?

Does it make a difference if you filter a View inside or outside the View? For example, is there any difference between these two queries? SELECT Id FROM MyTable WHERE SomeColumn = 1 Or SELECT Id FROM MyView WHERE SomeColumn = 1 And MyView is…
Rachel
  • 8,477
  • 20
  • 50
  • 74
34
votes
1 answer

Change length of varchar on live prod table

I have a MS SQL Server 2008 R2 DB server currently in use with a production app. A new enhancement to the app now requires a varchar(100) column in a table to be increased in length. Can the length of this existing column in the prod DB be…
anataliocs
  • 465
  • 1
  • 7
  • 10
34
votes
2 answers

oracle - list users with access to certain tables

I'm sure this has been asked before but I can't seem to find the relevant details for the following. Is there some sort of pre-built table that can do the following (I have used dba_tab_privs but it is limited and does not meet all my needs), if not…
dgf
  • 359
  • 1
  • 3
  • 4
34
votes
1 answer

What is the meaning of n_live_tup and n_dead_tup in pg_stat_user_tables

What is the meaning of n_live_tup and n_dead_tup in pg_stat_user_tables or pgstattuple?
Majid Azimi
  • 2,261
  • 3
  • 23
  • 24
34
votes
3 answers

How to remove string quotes in MySQL 5.7 for function JSON_EXTRACT?

Other than doing string manipulation after each JSON_EXTRACT, is there a simpler or more correct way to have the JSON_EXTRACT return the string WITHOUT the enclosing quotes? Or should this question be on StachExchange?
Hvisage
  • 473
  • 1
  • 4
  • 6
34
votes
2 answers

How to duplicate the database in postgresql?

I need to duplicate the existing database including its schema and structure to another new database. I need this in shell command environment and not in pgadmin. Please kindly help me. nohup pg_dump exampledb > example-01.sql createdb -O postgres…
Karunya Suresh
  • 441
  • 1
  • 4
  • 4
34
votes
3 answers

What does OPTION FAST in SELECT statement do?

I have done some digging on what the OPTION (FAST XXX) query hint does inside a SELECT statement and I'm still confused about it. According to MSDN: Specifies that the query is optimized for fast retrieval of the first number_rows. This is a…
Matthew Verstraete
  • 915
  • 4
  • 12
  • 28
34
votes
1 answer

DELETE rows which are not referenced in other table

I have two tables in a PostgreSQL 9.3 database: Table link_reply has a foreign key named which_group pointing to table link_group. I want to delete all rows from link_group where no related row in link_reply exists. Sounds basic enough but I've been…
Hassan Baig
  • 1,959
  • 8
  • 29
  • 41
34
votes
1 answer

Query JSON array of obejcts against multiple values

I want to write a query against a jsonb type table-column in Postgres that, given an array of customers IDs, will find corresponding groups. Given this example table: CREATE TABLE grp(d jsonb NOT NULL); INSERT INTO grp VALUES …
BartZ
  • 443
  • 1
  • 4
  • 4
34
votes
3 answers

What is the recommended way to backup a MySQL/Amazon RDS database to S3?

I have two purposes for this: To have an offsite backup in case of a region wide problem with Amazon Web Services. To copy production data from a production billing account to a beta billing account. Currently it does not appear that Amazon…
Peter Stephens
  • 443
  • 1
  • 4
  • 6
34
votes
1 answer

Mongodb incremental backups

I was given the task to set up incremental backups for MongoDB replicaset, as start point, of course, I googled it and could not find anything on MongoDB docs, I did find however this question on Stack Overflow, which encouraged to develop my own…
Tiago
  • 441
  • 1
  • 4
  • 3