LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 01-10-2014, 03:59 AM   #1
jayram1989
LQ Newbie
 
Registered: Aug 2013
Posts: 13

Rep: Reputation: Disabled
Question mysql multi threading for a single query


I have big db of size 8GB and having 9 million contacts in this db. When we try to retrieve all contacts, it takes nearly 1 or 2 hour (in some cases result in timeout) to retreive all contacts for the excecution for a single query. Also I have 8 CPU and 24GB RAM, Xeon Processor, the mysql process won't distribute accross the 8 CPU's. My question is that, does we can enable multi threading for a single query.

Awaiting for your Reply
 
Old 01-10-2014, 04:31 AM   #2
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7 / 8
Posts: 3,572

Rep: Reputation: 1612Reputation: 1612Reputation: 1612Reputation: 1612Reputation: 1612Reputation: 1612Reputation: 1612Reputation: 1612Reputation: 1612Reputation: 1612Reputation: 1612
Sounds more like a badly designed query, think about index optimisation etc. first. It's my belief (may be wrong!) that MySQL doesn't thread single queries.
 
Old 01-10-2014, 04:42 AM   #3
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,387
Blog Entries: 24

Rep: Reputation: 4340Reputation: 4340Reputation: 4340Reputation: 4340Reputation: 4340Reputation: 4340Reputation: 4340Reputation: 4340Reputation: 4340Reputation: 4340Reputation: 4340
Quote:
Originally Posted by jayram1989 View Post
I have big db of size 8GB and having 9 million contacts in this db. When we try to retrieve all contacts, it takes nearly 1 or 2 hour (in some cases result in timeout) to retreive all contacts for the excecution for a single query. Also I have 8 CPU and 24GB RAM, Xeon Processor, the mysql process won't distribute accross the 8 CPU's. My question is that, does we can enable multi threading for a single query.

Awaiting for your Reply
What do you mean by "When we try to retrieve all contacts"? Retrieve them all to what - web browser, file, etc? Very often the data path can be the cause of slow retreival for very large result sets.

And I agree with TenTenths, you should probably look at your query itself, indexing, sorts on large result sets. You do not say what GNU/Linux or MySQL version, but in general it is pretty good about making good use of resources.

So, I would first look at bottlenecks in the retreival path and the query.
 
Old 01-11-2014, 12:04 AM   #4
jayram1989
LQ Newbie
 
Registered: Aug 2013
Posts: 13

Original Poster
Rep: Reputation: Disabled
I'm trying to retreive all contacts to web browser and it have the function indexing for all query, MYsql version 5.56
 
Old 01-11-2014, 12:43 AM   #5
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,387
Blog Entries: 24

Rep: Reputation: 4340Reputation: 4340Reputation: 4340Reputation: 4340Reputation: 4340Reputation: 4340Reputation: 4340Reputation: 4340Reputation: 4340Reputation: 4340Reputation: 4340
Quote:
Originally Posted by jayram1989 View Post
I'm trying to retreive all contacts to web browser and it have the function indexing for all query, MYsql version 5.56
I still have no idea what you are asking.

At first I thought that you were talking about retreiving ALL 9 million records at once. If so, and if you are retreiving them into a browser... then good luck! Not only would that take forever, it would also be mostly useless.

But I suspect that you are asking about retreiving some subset of records such as all contacts in a certain location, or with a certain name, etc. If that is the case then it will depend on the schema (table structure), indexing and how the queries are structured.

So, could you provide at least the following:

1. The table structure you are querying
2. An example of a query you are using to return some subset of records

Then we cna begin to offer useful suggestions.
 
  


Reply

Tags
linux, mysql, ubuntu


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: The Multi-Table Query Generator using phpMyAdmin and MySQL LXer Syndicated Linux News 0 02-18-2009 08:01 AM
Multi-threading in C Mr Tummyfluff Programming 3 11-08-2008 01:13 PM
multi threading slower than single threading on dual core. why? nebojsa.andjelkovic Programming 13 01-30-2007 09:56 PM
problems about multi-threading and/or multi-processing with tcp network in java ... alred Programming 5 06-23-2006 03:21 PM
Multi threading Mohsen Programming 5 03-01-2003 11:13 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:14 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration