database-optimization

Advantages of having user authentication details stored in a separate table

有些话、适合烂在心里 提交于 2019-12-10 18:06:29
问题 I have a user table in mysql containing all user data (firstname, surname, address, etc) But should I store the authentication details in another table (username, password) and link the two tables via a user ID? Is there much point in this? Is it more secure? or does it just add extra coding? 回答1: Is there much point in this? Nope, not at all. Is it more secure? If someone can access your users table they can surely access whatever other table the passwords are on, so no. or does it just add

Which of the following SQL queries would be faster? A join on two tables or successive queries?

落爺英雄遲暮 提交于 2019-12-10 17:54:33
问题 I have two tables here: ITEMS ID| DETAILS| .....| OWNER USERS: ID| NAME|.... Where ITEMS.OWNER = USERS.ID I'm listing the items out with their respective owners names. For this I could use a join on both tables or I could select all the ITEMS and loop through them making a sql query to retrieve the tuple of that itmes owner. Thats like: 1 sql with a JOIN versus 1x20 single table sql queries Which would be a better apporach to take in terms of speed? Thanks 回答1: Every query has overhead. If

Is inserting a new database entry faster than checking if the entry exists first?

泄露秘密 提交于 2019-12-10 13:04:00
问题 I was once told that it is faster to just run an insert and let the insert fail than to check if a database entry exists and then inserting if it is missing. I was also told that that most databases are heavily optimized for reading reading rather than writing, so wouldn't a quick check be faster than a slow insert? Is this a question of the expected number of collisions? (IE it's faster to insert only if there is a low chance of the entry already existing.) Does it depend on the database

How much size I will save if changed INT column to MEDIUMINT?

别来无恙 提交于 2019-12-08 15:42:52
I'm learning how to optimize my database by re choosing the correct data types for the columns and I want to know how much size I will save if I choose MEDIUMINT (3 Bytes) instead of INT (4 Bytes) AFAIK -and correct me if I'm wrong- I need the database size to be as small as possible to fit in RAM to reduce the hard-desk requests. The size of the database consists of the tables sizes + index sizes giving that I have an INT column that has 10'000'000 rows and a B-Tree index on it, how much size In MBs I will save if I changed the datatype of the column from INT to MEDIUMINT at table data size ?

Does GAE Datastore support eager fetching?

三世轮回 提交于 2019-12-08 02:39:35
问题 Let's say I want to display a list of books and their authors. In traditional database design, I would issue a single query to retrieve rows from the Book table as well as the related Author table, a step known as eager fetching . This is done to avoid the dreaded N+1 select problem : If the Author records were retrieved lazily, my program would have to issue a separate query for each author, possibly as many queries as there are books in the list. Does Google App Engine Datastore provide a

Should primary keys always be added to an innodb table?

做~自己de王妃 提交于 2019-12-07 05:20:09
问题 I have some innoDbs with only 2 int columns which are foreign keys to the primary keys of other tables. E.g one table is user_items, it has 2 columns, userId, itemId, both foreign keys to user and item tables, set to cascade if updated or deleted. Should I add a 3rd column to such tables and make it a primary key, or is it better the way it is right now, in terms of performance or any other benefits? 回答1: Adding a third ID column just for the sake of adding an ID column makes no sense. In

Does GAE Datastore support eager fetching?

孤者浪人 提交于 2019-12-06 13:57:21
Let's say I want to display a list of books and their authors. In traditional database design, I would issue a single query to retrieve rows from the Book table as well as the related Author table, a step known as eager fetching . This is done to avoid the dreaded N+1 select problem : If the Author records were retrieved lazily, my program would have to issue a separate query for each author, possibly as many queries as there are books in the list. Does Google App Engine Datastore provide a similar mechanism, or is the N+1 select problem something that is no longer relevant on this platform? I

Should primary keys always be added to an innodb table?

六月ゝ 毕业季﹏ 提交于 2019-12-05 10:33:03
I have some innoDbs with only 2 int columns which are foreign keys to the primary keys of other tables. E.g one table is user_items, it has 2 columns, userId, itemId, both foreign keys to user and item tables, set to cascade if updated or deleted. Should I add a 3rd column to such tables and make it a primary key, or is it better the way it is right now, in terms of performance or any other benefits? Adding a third ID column just for the sake of adding an ID column makes no sense. In fact it simply adds processing overhead (index maintenance) when you insert or delete rows. A primary key is

MYSQL database optimization using indexing [closed]

≯℡__Kan透↙ 提交于 2019-12-02 23:37:06
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . I am working on LearnBiz Simulations, a self-funded start-up which makes simulations for the domain of management education. (a) Our website is currently catering to about 16k people. Currently, size of database is 30 mb with a total of about 90 tables and each table may have anywhere between 5 to 50 columns.

MYSQL database optimization using indexing [closed]

前提是你 提交于 2019-12-02 13:27:52
I am working on LearnBiz Simulations , a self-funded start-up which makes simulations for the domain of management education. (a) Our website is currently catering to about 16k people. Currently, size of database is 30 mb with a total of about 90 tables and each table may have anywhere between 5 to 50 columns. All our tables in the database, repeatedly have new rows of insertions, deletions or updations. But no columns are ever added. Does it create any issues with employing indexing techniques? There were a couple of other forums and videos which suggests that even inserting or deleting a row

工具导航Map