473,395 Members | 1,948 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Which will give me better performance (Table design for Joins)

20
I have two tables Users and UserLogin. Here i will use two methods of table design. and which query will return me the result more fast.
The table size will be large that it may contain records in lakhs.

Method 1:
Tables:
Users ( UserID varchar(20) primary key, PassWord varchar(20))
UsersLogin(UserID varchar(20),LoginDate DateTime)
Query:
Select Users.UserID,UsersLogin.LoginDate
from Users U inner join UsersLogin UL
on Users.UserID = UsersLogin.UserID
Method 2:
Tables:
Users ( SysUserID Integer primary key,UserID varchar(20), PassWord varchar(20))
UsersLogin(SysUserID Integer, LoginDate DateTime)
Query:
Select Users.UserID,UsersLogin.LoginDate
from Users U inner join UsersLogin UL
on Users.SysUserID = UsersLogin.SysUserID
Here for the seccond method i made SysUserID additional which will be a system generated ID, and for joins which will give better performance.
Feb 26 '07 #1
1 1369
ronverdonk
4,258 Expert 4TB
You can find that out by using the EXPLAIN SELECT ... in MySQL and study the results for each table.

Ronald :cool:
Feb 26 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: Randell D. | last post by:
Folks, I once read an article in Linux Format whereby a technical writer had made performance recommendations on a LAMP environment. One of the points raised was for small columns in a database,...
3
by: Robert | last post by:
I am having performance issues on a SQL query in Access. My query is accessing and joining several tables (one very large one). The tables are linked ODBC. The client submits the query to the...
1
by: Jason | last post by:
Hi all, I have 1 table which need to store 7 days data in a row, I not sure which table design will gain better performance in SELECT statement. Desgin 1. 7 columns (day1, ..., day7) with char(4)...
5
by: mm nn | last post by:
Hi, I want to create a table like this: ID Autonum Datefld Date Cat Text Itm Text tCount Number
5
by: Peggy Wu | last post by:
dear all, I am a programmer ,coding in IBM COBOL and the DB is DB2 V6 on OS/390. As below, for the performance issue, Does anyone know which one is better ?? To get a record that field A has a...
5
by: mail | last post by:
Urgent help needed! I moved an application from ASP+ACCESS to ASP+MS SQLSERVER and I have the following problem: If the join on two tables results on duplicate colum names (which appear in...
5
by: alingsjtu | last post by:
Hello, every body. When execute dynamic generated multiple OPENQUERY statements (which linkes to DB2) in SQLServer, I always got SQL1040N The maximum number of applications is already connected...
2
by: prileep | last post by:
I have two tables Users and UserLogin. Here i will use two methods of table design. and which query will return me the result more fast. The table size will be large that it may contain records in...
4
by: Igor | last post by:
I currently have two tables: 1: users id_user username 2: baned_users id_user i tought i could use something like this 1: users
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.