database-design

How many records can I store in 5 MB of PostgreSQL on Heroku?

拥有回忆 提交于 2019-12-29 04:02:14
问题 I'm going to store records in a single table with 2 fields: id -> 4 characters password_hash -> 64 characters How many records like the one above will I be able to store in a 5mb PostgreSQL on Heroku? P.S.: given a single table with x columns and a length of y - how can I calculate the space it will take in a database? 回答1: Disk space occupied Calculating the space on disk is not trivial. You have to take into account: The overhead per table (small, basically the entries in the system catalog

Best method to store Enum in Database

巧了我就是萌 提交于 2019-12-29 02:32:24
问题 What is the best method of storing an Enum in a Database using C# And Visual Studio and MySQL Data Connector. I am going to be creating a new project with over 100 Enums, and majority of them will have to be stored in the database. Creating converters for each one would be a long winded process therefore I'm wondering if visual studio or someone has any methods for this that I haven't heard off. 回答1: [Required] public virtual int PhoneTypeId { get { return (int)this.PhoneType; } set {

Basic database design : list of instances of type

末鹿安然 提交于 2019-12-29 02:16:11
问题 This is a beginners question about database design. Suppose we have a blogging website with many users, each of whom have a few blog posts. We want to quickly find all articles written by a given user. We could search the post table for all blog posts with the given userID. We could also design the user table to have a list of the user's posts. This would mean, perhaps, storing a string of comma separated post IDs. What is the proper way to do this? 回答1: You're looking for database

Table relationship for subtypes

假如想象 提交于 2019-12-29 01:57:13
问题 I have a parent table called 'Website' which holds records about websites. I have a child table called 'SupportSystem' which holds records about different types of support systems such as email, phone, ticketing, live chat etc. There is an intermediate table 'Website_SupportSystem' which joins these tables in a many-many relationship. If the SupportSystem for a Website is ticketing, I also want to record the software platform .e.g. WHMCS. My instinct is to create a new lookup table called

Trigger vs. check constraint

☆樱花仙子☆ 提交于 2019-12-28 18:14:25
问题 I want to add a field-level validation on a table. There is a field named "account_number" and this field should always pass a "luhn" check. I've found a function called "luhn_verify" that seems to work properly (google for it if you are interested). It returns a boolean. My question is: Are there any major performance advantages in PostgreSQL for using a trigger for this validation vs. a check constraint. Additional information: PostgreSQL 9.1 Table does not currently have an insert trigger,

How many columns is too many columns? [closed]

微笑、不失礼 提交于 2019-12-28 12:09:08
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 12 months ago . I've noticed that a lot of folks here cite tables with 20+ (I've seen as much as 55) columns in one table. Now I don't pretend to be a database design expert, but I've always heard that this is a horrible practice. When I see this, I usually suggest splitting into two

What's the best way to store changes to database records that require approval before being visible?

若如初见. 提交于 2019-12-28 07:58:14
问题 I need to store user entered changes to a particular table, but not show those changes until they have been viewed and approved by an administrative user. While those changes are still in a pending state, I would still display the old version of the data. What would be the best way of storing these changes waiting for approval? I have thought of several ways, but can't figure out what is the best method. This is a very small web app. One way would be to have a PendingChanges table that mimics

This should be simple. But how do I design this?

…衆ロ難τιáo~ 提交于 2019-12-28 07:07:32
问题 I have 2 kinds of business units; division and department. A business units has to be one or the other, but cannot be both. So this is easy enough. Have a BusinessUnit table and a BusinessUnitType lookup table containing division and department. However only divisions can contain teams. For each division there are one to many teams. Departments do not have teams. So what should I be doing here? Maybe I should have a flag on the BusinessUnitType table called hasTeam? Is that the best way to

Use item specific prefixes and autonumber for primary keys?

纵饮孤独 提交于 2019-12-28 05:52:30
问题 We had a meeting this morning about how would should store our ID for some assets that we have in our database that we are making, the descusion generated a bit of heat so I decided to consult the experts of SO. The table structure that I belive that we should have(short version) is like the following: Example 1) AssetId - int(32) - Primary Key Type - string so some example data is like this: ==AssetId======Type=== 12345 "Manhole" 155415 "Pit" etc. Another member of the team suggested

Should I always prefer MySQL InnoDB over MyISAM?

我的梦境 提交于 2019-12-28 05:10:21
问题 Someone just told me that InnoDB is much better than MyISAM. So when I create a table, should I always try to use InnoDB Engine instead of MyISAM? Or do both have it's big benefits? 回答1: MyISAM is transactionless and heap-organized. The records are identified by the row offset in the table and the indexes store this offset as a row pointer. InnoDB supports transactions and is index-organized. The records are identified by the value of the PRIMARY KEY (or a hidden internal column is there is