Search
Search titles only
By:
Search titles only
By:
Log in
Register
Search
Search titles only
By:
Search titles only
By:
Menu
Install the app
Install
Forums
New posts
All threads
Latest threads
New posts
Trending threads
Trending
Search forums
What's new
New posts
New ads
New profile posts
Latest activity
Free Ads
Latest reviews
Search ads
Members
Current visitors
New profile posts
Search profile posts
Contact us
Latest ads
RHCSA, RHCE, AWS, Docker, Kubernetes Training
Sanjeewani95
Updated:
Tuesday at 10:28 AM
🛡️ Kaspersky Antivirus – 1 Year / 1 Device | Rs. 2,300 | Only 9 Left
KSPathirana
Updated:
Monday at 2:42 PM
Ad icon
Professional CCTV Installation Service
Techguy231
Updated:
Sunday at 10:50 AM
Ad icon
I'll research & write an article - Rs. 2000 onwards
Blogerwiki
Updated:
Sep 3, 2026
House Plan
lenura
Updated:
Sep 2, 2026
Electronics
Vehicles
Property
Search
Reply to thread
Forums
Computers & Internet
Problems and Troubleshooting
MYSQL Query Help
Get the App
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Message
<blockquote data-quote="MihiCherub" data-source="post: 21309780" data-attributes="member: 238676"><p><span style="font-size: 12px">මචන්ල පුලුවන් නම් මේකට හෙල්ප් එකක්</span></p><p><span style="font-size: 12px"></span></p><p><span style="font-size: 12px">MYSQL table එකක් තියෙනව 1M Records.</span></p><p><span style="font-size: 12px">[CODE]</span></p><p><span style="font-size: 12px">CREATE TABLE `products` (</span></p><p><span style="font-size: 12px"> `pid` INT(6) NOT NULL AUTO_INCREMENT,</span></p><p><span style="font-size: 12px"> `name` VARCHAR(200) NOT NULL,</span></p><p><span style="font-size: 12px"> `ptype` VARCHAR(10) NOT NULL,</span></p><p><span style="font-size: 12px"> PRIMARY KEY (`pid`)</span></p><p><span style="font-size: 12px">)</span></p><p><span style="font-size: 12px">[/CODE]මේකෙ ptype වර්ග 10ක් විතර තියෙනව. Ex - Inventory, Raw, etc ...</span></p><p><span style="font-size: 12px"></span></p><p><span style="font-size: 12px">මේ table එකට select query ලිව්වාම (without limit) type එකක් විතරක් select කරගන්න execution time avg 2.2s. </span></p><p><span style="font-size: 12px">[CODE]SELECT * FROM products WHERE ptype = 'Inventory'[/CODE]types ගාන වැඩි වෙනකොට execution time එකත් වැඩි වෙනව.</span></p><p><span style="font-size: 12px">[CODE]SELECT * FROM products WHERE ptype = 'Inventory' OR ptype = 'Raw' [/CODE]execution time avg 3.3s. </span></p><p><span style="font-size: 12px"></span></p><p><span style="font-size: 12px">[CODE]SELECT * FROM products WHERE ptype = 'Inventory' OR ptype = 'Raw' OR ptype = 'Service' [/CODE]execution time avg 4.6s. </span></p><p><span style="font-size: 12px"></span></p><p><span style="font-size: 12px">ඒ නිසා මම ptype එකට index එකක් දැන්ම.</span></p><p><span style="font-size: 12px">[CODE]CREATE INDEX PTYPE_INDEX ON products (ptype)[/CODE]දැන් Where clause එකේ ptype දෙකක් හෝ වැඩි ගානක් තිබ්බාම execution time එක පොඩ්ඩක් අඩු උනත් තනි where clause එකේදි time එක ඩබල් වෙනව.</span></p><p><span style="font-size: 12px">[CODE]SELECT * FROM products WHERE ptype = 'Inventory' [/CODE]execution time avg 4.3s</span></p><p><span style="font-size: 12px">.</span></p><p><span style="font-size: 12px">මේකට හොදම විසදුමක් පුලුවන් කෙනෙක් කියන්නකො</span></p><p> <span style="font-size: 12px"></span></p></blockquote><p></p>
[QUOTE="MihiCherub, post: 21309780, member: 238676"] [SIZE=3]මචන්ල පුලුවන් නම් මේකට හෙල්ප් එකක් MYSQL table එකක් තියෙනව 1M Records. [CODE] CREATE TABLE `products` ( `pid` INT(6) NOT NULL AUTO_INCREMENT, `name` VARCHAR(200) NOT NULL, `ptype` VARCHAR(10) NOT NULL, PRIMARY KEY (`pid`) ) [/CODE]මේකෙ ptype වර්ග 10ක් විතර තියෙනව. Ex - Inventory, Raw, etc ... මේ table එකට select query ලිව්වාම (without limit) type එකක් විතරක් select කරගන්න execution time avg 2.2s. [CODE]SELECT * FROM products WHERE ptype = 'Inventory'[/CODE]types ගාන වැඩි වෙනකොට execution time එකත් වැඩි වෙනව. [CODE]SELECT * FROM products WHERE ptype = 'Inventory' OR ptype = 'Raw' [/CODE]execution time avg 3.3s. [CODE]SELECT * FROM products WHERE ptype = 'Inventory' OR ptype = 'Raw' OR ptype = 'Service' [/CODE]execution time avg 4.6s. ඒ නිසා මම ptype එකට index එකක් දැන්ම. [CODE]CREATE INDEX PTYPE_INDEX ON products (ptype)[/CODE]දැන් Where clause එකේ ptype දෙකක් හෝ වැඩි ගානක් තිබ්බාම execution time එක පොඩ්ඩක් අඩු උනත් තනි where clause එකේදි time එක ඩබල් වෙනව. [CODE]SELECT * FROM products WHERE ptype = 'Inventory' [/CODE]execution time avg 4.3s . මේකට හොදම විසදුමක් පුලුවන් කෙනෙක් කියන්නකො [/SIZE] [/QUOTE]
Insert quotes…
Verification
Hathara warak wissa keeyada? (Hathara wadi karanna 20)
Post reply
Top
Bottom