Jump to content

Handling php with large database


ascentlogic

Recommended Posts

Hi, i am php programmer , i need help from php expert to create php apllication for large database .

I have database table called "profiles" which contains millions(1.5 to 2 million) of profile of the business companies. This table has 10 fields and there is one field named as "bname" which is name of company , i made this column full-text index for full-text search .

 

Now , i have to use this table for profile searching (using full-text search), profiles within particular cities , profiles within particular categories etc. This table contains millions of records so it will take lots of time for searching and fetching the reocrd(s) from this table.

Can anybody help me that how can i manage this large table to improve the performance and fast searching with php ? Is there any other technique (algorithm) to manage large database (like facebook,twiiter,orkut)?

Link to comment
Share on other sites

2 million rows is not large at all, provided you configured your server well and structured your data properly.

There's not much more we can tell without seeing your table structure and sample query.

Link to comment
Share on other sites

Hi, i am php programmer , i need help from php expert to create php apllication for large database .

I have database table called "profiles" which contains billions(1.5 to 2 billion) of profile of the business companies. This table has 10 fields and there is one field named as "name" which is name of company , i made this column full-text index for full-text search .

 

Now , i have to use this table for profile searching (using full-text search), profiles within particular cities , profiles within particular categories etc. This table contains billions of records so it will take lots of time for searching and fetching the reocrd(s) from this table.

Can anybody help me that how can i manage this large table to  improve the performance and fast searching with php ? Is there any other technique (algorithm) to manage large database (like facebook,twiiter,orkut)

 

following is the table structure

 

CREATE TABLE IF NOT EXISTS `profiles` (

  `id` int(11) NOT NULL AUTO_INCREMENT,

  `cityid` int(11) NOT NULL,

  `cid` int(11) NOT NULL,

  `name` varchar(200) NOT NULL,

  `phone` varchar(20) NOT NULL,

  `fax` varchar(20) NOT NULL,

  `address` varchar(1000) NOT NULL,

  `city` varchar(1000) NOT NULL,

  `state` varchar(100) NOT NULL,

  `zip` varchar(20) NOT NULL,

  `county` varchar(100) NOT NULL,

  `contact` varchar(100) NOT NULL,

  `gender` varchar(10) NOT NULL,

  `jobtitle` varchar(1000) NOT NULL,

  `website` varchar(100) NOT NULL,

  `email` varchar(100) NOT NULL,

  `emplayees` int(11) NOT NULL,

  `sales` int(100) NOT NULL,

  `type` varchar(1000) NOT NULL,

  `maincat` varchar(1000) NOT NULL,

  `url` varchar(500) NOT NULL,

  PRIMARY KEY (`id`),

  KEY `city` (`city`),

  KEY `cityid` (`cityid`),

  KEY `cid` (`cid`),

  FULLTEXT KEY `name` (`name`)

)

 

Queries are :

1) select p.id,p.name,p.address,p.cityid,p.url,c.city,s.state,match(p.name) against('keywords') as score from profiles p,cities c,states s where 1=1 and p.cityid=c.id and c.stateid=s.stateid and match(p.name) against('keywords' in boolean mode) order by score desc

 

2) select p.id,p.name,p.address,p.cityid,p.url,c.city,s.state from profiles p,cities c,states s where 1=1 and p.cityid=c.id and c.stateid=s.stateid and cid=2 order by p.name asc

 

3) select p.id,p.name,p.address,p.cityid,p.url,c.city,s.state from profiles p,cities c,states s where 1=1 and p.cityid=c.id and c.stateid=s.stateid and s.stateid=33 and cityid=7810 order by p.name asc

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

  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.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.