Questions tagged [postgres]

PostgreSQL, A.K.A Postgres, is an open source object-relational database management system (ORDBMS).

142 questions
173
votes
21 answers

Stored Procedures a bad practice at one of worlds largest IT software consulting firms?

I'm working at a project in one of the world's top 3 IT consulting firms, and was told by a DBA that company best practice's state stored procedures are not a "best practice". This is so contrary to everything I've learned. Stored procedures give…
user22453
  • 477
  • 3
  • 6
  • 8
128
votes
10 answers

Storing a re-orderable list in a database

I'm working on a wishlist system, where users can add items to their various wishlists, and I plan to allow users to re-order the items later on. I am not really sure about the best way to go about storing this in a database while remaining fast and…
Tom Brunoli
  • 1,383
  • 2
  • 9
  • 6
41
votes
3 answers

Is there any reason to use varchar over text columns in a database?

Is varchar just a remnant from before text came around, or are there use cases where you would want to use a varchar? (Or char for that matter..) (I use Postgres and MySQL (MyISAM) daily, so those are what I'm most interested in, but answers for…
Izkata
  • 6,048
  • 6
  • 28
  • 43
19
votes
2 answers

How to get real time notifications, when a database change (insert, update, delete) occurs?

I'm creating a dashboard which should monitor a database table. I have only database access (no application layer). The table is rather large (10 million rows), however not changing rapidly (100 inserts/updates per minute) How can I find out whether…
Kiril
  • 529
  • 2
  • 4
  • 11
14
votes
5 answers

How can I efficiently diff a CSV file against a database?

I have an inventory of products stored in Postgres. I need to be able to take a CSV file and get a list of changes—the things in the CSV file that are different to what is in the database. The CSV file has about 1.6 million rows. The naive approach…
Isvara
  • 610
  • 6
  • 18
14
votes
6 answers

What are the best practices around retiring obsolete database columns?

I'm designing an application which will in an early stage collect data A, B, and C from clients, but later on will instead collect data A, B, and D. A, B, C, and D are very related and right now exist as columns of a single database PostgreSQL table…
Jad S
  • 561
  • 5
  • 10
12
votes
9 answers

Is there a large bank using Mysql or PostgreSQL?

I always thought the largest scale of banks use Oracle. However, there is no proof they really use Oracle instead of Mysql or PostgreSQL, nobody knows the secret. Any idea what they really use? Can i build an ATM/Bank system where millions of…
YumYumYum
  • 377
  • 2
  • 4
  • 12
11
votes
3 answers

Storing hours a merchant is open in postgres

In postgres, I need to store the hours a merchant is open each week. Essentially, the information you'd see posted on a sign in the merchant's door: Mondays: Closed Tuesday-Friday: 9am-1pm, 2pm-6pm Weekends: 10am-2pm Some ideas so far: Break down…
Jonah
  • 1,436
  • 2
  • 14
  • 18
10
votes
5 answers

Do I really need triggers for relational database, for example, PostgreSQL?

I know that triggers can be used to validate stored data to keep database consistent. However, why not perform validation of data on the application side before storing them into the database? For example, we store clients, and we want to perform…
Yan Khonski
  • 211
  • 1
  • 8
8
votes
4 answers

What is the "correct" way to store functions in a database?

Note: Yes, I know that storing functions in databases should be punishable by law. We are developing a financial web application using PostgreSQL, Sinatra and AngularJS. As you may have guessed, a financial application may need some…
Ianis Vasilev
  • 107
  • 1
  • 1
  • 4
8
votes
2 answers

Making the switch from MySQL to PostgreSQL?

I've spent the last year becoming really comfortable with MySQL, but due to its increasing trendiness and my desire to homogenize my web-apps with Heroku, I'd like to start using PostgreSQL for my web apps instead. There are a resources out there…
Andrew Latham
  • 586
  • 4
  • 13
7
votes
3 answers

Do common relational database systems work 'out of the box'?

I'm quite new to software development and whenever I come across small projects which involve storing (relational) data I always ask myself if something like a micro-blog (or any other project with few users that stores few types of data) really…
One One
  • 89
  • 1
6
votes
2 answers

Scalability: Millions of tables vs one big master table and millions of views

We have to migrate an old (million LOC) system from SAP ADS (formerly Sybase) ISAM based (so called free tables) based system to a PostgreSQL database. The system implements kind of multitenancy regarding putting some basic information (chancellery…
6
votes
4 answers

DB Enumerations vs App Enumerations vs Lookup tables

We started a project recently, and during the design process, we have some arguments among team members. We have to deal with enumerations so we ended up with three choices. Have the enumerations as Normal Enums in Database Have the enumerations…
pik4
  • 365
  • 3
  • 13
6
votes
1 answer

Database Model description using constants

I want to create a class with static constants which are used whenever a part of an application want to access the database in any way. This way I want to remove all magic numbers and string inside my application code except at one place. So any…
maxik
  • 163
  • 1
  • 6
1
2 3
9 10