rdbms

Do numerical primary keys of deleted records in a database get reused for future new records?

做~自己de王妃 提交于 2019-12-05 11:03:02
For example if I have an auto-numbered field, I add new records without specifying this field and let DB engine to pick it for me. So, will it pick the number of the deleted record? If yes, when? // SQL Server, MySQL. // Follow-up question: What happens when DB engine runs out of numbers to use for primary keys? NO. numerical primary keys will not reused, except you specify them manually(you should really avoid this!) AFAIK, this could happen in MySQL: How AUTO_INCREMENT Handling Works in InnoDB : InnoDB uses the in-memory auto-increment counter as long as the server runs. When the server is

Choosing between a directory server (a.k.a LDAP database) and an RDBMS

泄露秘密 提交于 2019-12-05 10:27:44
In my project, where I'm the lead developer, we earlier had a network configuration that was stored a single XML file. The configuration contains info about a network layout - its constituent hosts, various details about each host like OS, platform, users configured in each them, several attributes for each user and so on. In the forthcoming version of the product, we want to move the data into a database of some sort since the configuration will be expanded to include more elements and details and maintaining them in XML files will start becoming cumbersome. The first choice was an RDBMS.

ORMs are to RDBMSs as xxx is to OLAP cubes? Does xxx exist?

只谈情不闲聊 提交于 2019-12-05 10:01:32
Is there an ORM-analogue for querying OLAP cubes / data-warehouses? I'm specifically interested in the .NET world, but generally interested in anything ;-) I've started an open source project, Kona, to wrap the ADOMD.Net lib, and try to bring ADOMD.Net into the 21st Century. You can get it up at http://www.codeplex.com/kona , but it does need some more love and attention. The task of converting lambdas to MDX isn't a small one, so I haven't even tried to to that, yet. I've tried to encourage MSFT to write a LINQ to MDX provider, but considering how few .Net developers are actually trying to

Is there a formula to estimate index size in InnoDB?

浪子不回头ぞ 提交于 2019-12-05 07:30:31
问题 How is it possible to calculate index size for specific column types in InnoDB i.e.: VARCHAR CHAR TIMESTAMP SMALLINT I've found a formula for MyISAM (http://dev.mysql.com/doc/refman/5.7/en/key-space.html): (key_length+4)/0.67 Does this work for InnoDB as well? I'm trying to estimate the size of a database I'm designing for sizing purposes. 回答1: In InnoDB, the PRIMARY KEY is embedded with the data, so you can think of it as taking no space. For a secondary key... Take the MyISAM formula, but

When to switch from Spreadsheet to RDBMS?

烈酒焚心 提交于 2019-12-04 23:15:28
问题 I've volunteered with a Non-Governmental Organization to help with their record-keeping at their community centre. At present, there is only one community centre where all their data is stored. However, this is expected to change by the end of the year. Presently their data is maintained using a workbook with two sheets. Each record in the main sheet may have upto 100 follow-ups in the follow-up sheet. Data is loosely structured, and there are no explicit constraints. Moving all existing data

Only one key from composite primary key as foreign key

余生长醉 提交于 2019-12-04 19:20:18
In this database, key1 & key2 make up the composite primary key of table4 , but i'm able to add a foreign key to table3 that comprise just key1 . Why MySQL allows this? Does the above database design make no sense at all? TL;DR It's not standard SQL. MySQL documentation itself advises not doing it. In SQL a FOREIGN KEY declaration must reference a column list declared PRIMARY KEY or UNIQUE NOT NULL. (PRIMARY KEY creates a UNIQUE NOT NULL constraint.) (The constraint has to be explicit, even though any set of NOT NULL columns containing a set that is UNIQUE has to be unique.) The MySQL

Keeping one table or multiple table for similar type of data which one is best while considering high performance

ε祈祈猫儿з 提交于 2019-12-04 16:16:17
I am designing DATABASE for a Sales and Purchase application like ERP and using MYSQL as RDBMS, I have doubt on creating table for sales and purchase entities to go with single table for each module(Sale/Purchase) or multiple tables for each entities(Sales order, Sale invoice, Sale return, Purchase order, Purchase invoice, Purchase return) in longer run. Below is my use case. My application will have Sale Order, Sale Delivery, Sale Invoice, Sale Return and Credit Note and same entity for Purchase module also and all these entity may be enter linked in there module. Like Sale Order can be

What strategy to migrate data from a spreadsheet to an RDBMS?

*爱你&永不变心* 提交于 2019-12-04 12:58:45
This is linked to my other question when to move from a spreadsheet to RDBMS Having decided to move to an RDBMS from an excel book, here is what I propose to do. The existing data is loosely structured across two sheets in a work-book. The first sheet contains main record. The second sheet allows additional data. My target DBMS is mysql, but I'm open to suggestions. Define RDBMS schema Define, say, web-services to interface with the database so the same can be used for both, UI and migration. Define a migration script to Read each group of affiliated rows from the spreadsheet Apply validation

How do I create a (Type, ID) (aka 'polymorphic')- foreign key column in MS Access?

吃可爱长大的小学妹 提交于 2019-12-04 11:33:14
In Ruby-on-Rails, this is called a "polymorphic association." I have several Commentable things in my application, the tables for each are below: Post id | title | text | author (FK:Person.id) | ... Person id | name | ... Photo id | title | owner (FK:Person.id) | path | ... I'd like to add a Comments table as follows: Comments id | commentable_type | commentable_id | text | author (FK:Person.id) I understand that I lose the database's referential integrity this way, but the only other option is to have multiple Comments tables: PostComments , PersonComments , PhotoComments , ... And now for

Terribly slow SQL query with COUNT and GROUP BY on two columns

不想你离开。 提交于 2019-12-04 11:24:56
I'm archiving this web forum, which normally gets purged about once a week. So I'm screen scraping it, and storing it into my database (PostgreSQL). I also do a little analysis on the data, with some graphs for users to enjoy, like what time of day is the forum most active, and so forth. So I have a posts table, like so: Column | Type ------------+------------------------------ id | integer body | text created_at | timestamp without time zone topic_id | integer user_name | text user_id | integer And I now want to have a post count for each user, for my little top 10 posters table. I came up