Jump to content
php.lv forumi

Izskaidrojiet šito vienu lietu, par SQL


Sasa

Recommended Posts

izrāvumns no http://net.tutsplus.com/tutorials/other/10-essential-sql-tips-for-developers/

 

Therefore, if you're using indexing, you'll probably be perplexed as to why your query is taking forever, when it should be a simple index scan. This is the reason that developers need to pay special attention to data types and their applications. Non-key attributes which are IDs are often string types, as opposed to integers, because of the increased flexibility that is granted. However, this is also a trouble area for junior developers, who assume that ID fields will be integers.

 

Kā ID fields var nebūt integers kā tad strādās autoincrement, agrāk biju pārliecināts, ka ID ir vesels skaitlis, un tas arī tā visu laiku paliks! :|

Link to comment
Share on other sites

Pirmkārt tur iet runa arī par citām DB nevis tikai MySQL. Visās DB nav tāda jēdziena kā autoincrement. Otrkārt neviens jau nekavē izveidot ID kolonu bez autoincrement. Primārā atslēga jau var būt viena kolona, divas, n kolonas no kurām katra var būt int un var nebūt.

Otrkārt datu tipus ir jāskatās ne tikai DB tabulai, bet lai arī tie b;utu tādi paši select vaicājumā, ko tu padosi.

 

Gints Plivna

http://datubazes.wordpress.com

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...