database-design

SQL Server 2008: Disable index on one particular table partition

↘锁芯ラ 提交于 2019-12-24 01:05:33
问题 I am working with a big table (~100.000.000 rows) in SQL Server 2008. Frequently, I need to add and remove batches of ~30.000.000 rows to and from this table. Currently, before loading a large batch into the table, I disable indexes, I insert the data, then I rebuild the index. I have measured this to be the fastest approach. Since recently, I am considering implementing table partitioning on this table to increase speed. I will partition the table according to my batches. My question, will

How to select locations in Firestore and Android?

瘦欲@ 提交于 2019-12-24 01:01:39
问题 I'm very new to Cloud Firestore, so please help me. I'm creating an app for teensagers where I want to display a list of very nice locations in every city. I also want that every user can save any location to a favorite section so he or she can show that location list to his or her friends. My actual data: db -> users (all users) db -> locations (all locations) My problem: I want to find a way to set a location for a user as favorite. I'm thinking to create a new section under each user to

database table design thoughts . .

不想你离开。 提交于 2019-12-24 00:59:41
问题 I have a database structure issue I am looking for some opinions on. Let's say there is a scenario where users will use an application to request materials. There is the need to track who the requester is. There are three possible "types" of requesters. An individual (Person), a Department, and the Supplier supplying the materials themselves. In addition the Supplier object needs to be related as the Supplier as well. So the idea is in the Request table there is a RequestedByID FK. But the

Integer vs char for DB record property

∥☆過路亽.° 提交于 2019-12-24 00:59:17
问题 Say I have a table with real estate listings. Every listing can be either 'For sale' or 'For rent'. Therefore, I can map 'For sale' to 0, 'For rent' to 1 and store it as an INT in the database. However, it would be much more descriptive if I store it as 'sale' / 'rent' in a field of type CHAR. Or I can map 0 and 1 to two constants FOR_SALE and FOR_RENT in my program. Or use chars 'S' and 'R'. What are the best practices for storing such properties in a database with a condition that the total

Design a process to archive data (SQL Server 2005)

点点圈 提交于 2019-12-24 00:56:55
问题 We're designing a process to archive a set of records based on different criteria like date, status, etc... Simplified set of tables: Claim, ClaimDetails, StatusHistory (tracks changes in Claim status), Comments & Files Environment: SQL Server 2005, ASP.Net MVC (.NET Framework v3.5 SP1) Claim is the main entity and it has child row(s) in the sub tables mentioned. Some have details and others are used to track changes. Eventually based on some criteria a Claim becomes "ready to archive" as

How to handle tags in a noSQL database

别说谁变了你拦得住时间么 提交于 2019-12-24 00:46:08
问题 I have a noSQL db with products. These products obviously have some characteristics and I can filter the products out by their properties. How does this work with tags? More specifically, how should I structure the nodes such that I can filter out items with a specific tag? Firebase Follow up if you are familiar with Firebase .equalTo(): how would I structure my FB db and how would I query out items with a specic tag? One thing I was thinking of is to have seperate properties for the nodes, e

Rails Database Design: Use strings or integer?

折月煮酒 提交于 2019-12-23 23:23:42
问题 Suppose I have a rails tables containing information chosen from a set number of options. For example, a field named sex could be either Male or Female . A field named Bodytype will be either slim , curvy , etc. My question is, what is better practice, to store those values as integers or strings? In the first case, of course, the integers will be converted into text (In the controller?). Thanks for all your help. 回答1: If are you are not storing millions of records, storing them as strings is

How would you model data variables variance on common scheme? SQL

情到浓时终转凉″ 提交于 2019-12-23 23:19:55
问题 I was thinking about some stuff lately and I was wondering what would be the RIGHT way to do something like the following scenario (I'm sure it is a quite common thing for DB guys to do something like it). Let's say you have a products table, something like this (MySQL): CREATE TABLE `products` ( `id` int(11) NOT NULL auto_increment, `product_name` varchar(255) default NULL, `product_description` text, KEY `id` (`id`), KEY `product_name` (`product_name`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8;

What is the best data type to store boolean values in a database

こ雲淡風輕ζ 提交于 2019-12-23 21:15:26
问题 What is the best data type to store boolean values in a database? which is supported by mostly used RDBMS types such as Mysql,oracle,postgres,mssql 回答1: you can use TINYINT or bit datatype 回答2: If the DBMS supports a real boolean type (e.g. PostgreSQL) then use that. If it doesn't I usually prefer an integer value combined with a check constraint that ensures that only 0 and 1 can be stored. In my experience it also makes sense to define the column as NOT NULL as well. Having a NULL value for

Int PK inner join Vs Guid PK inner Join on SQL Server. Execution plan

余生长醉 提交于 2019-12-23 19:16:12
问题 I just did some testing for Int PK join Vs Guid PK. Tables structure and number of records looking like that: Performance of CRUD operations using EF4 are pretty similar in both cases. There is well known statement that Int PK has better performance rather than strings when used in joins. So SQL server execution plan with INNER JOINS are completely different Here is an execution plan: As i understand according with execution plan from above Int join has better performance because it is taking