drq231358 2013-05-10 19:31
浏览 24
已采纳

针对大型单表的MySQL查询优化[关闭]

I need to ask you about making my MySQL query more efficient. I have a table of posts with 1M records.

I am not using any join, and it's fetching result from database in 5-10 seconds - I don't know how can I make it efficient to retrieve data fast. Here is my query:

SELECT
    post_id, post_title, post_des, post_date,
    post_status, user_id, post_price
FROM
    post

Here is the table structure:

CREATE TABLE `post` (
  `post_id` int(11) NOT NULL AUTO_INCREMENT,
  `post_title` varchar(255) NOT NULL,
  `post_des` text NOT NULL,
  `post_date` datetime NOT NULL,
  `edit_date` datetime NOT NULL,
  `post_status` varchar(255) NOT NULL,
  `user_id` int(11) NOT NULL,
  `featuered` varchar(255) NOT NULL,
  `sub_cat_id` int(11) NOT NULL,
  `cat_id` int(11) NOT NULL,
  `post_price` varchar(100) NOT NULL,
  `post_img` varchar(255) NOT NULL DEFAULT 'uploads/no_image.jpg',
  `post_country_id` int(11) NOT NULL,
  `post_state_id` int(11) NOT NULL,
  `post_city_id` int(11) NOT NULL,
  `post_ref` varchar(255) NOT NULL,
  PRIMARY KEY (`post_id`,`post_date`)
) ENGINE=InnoDB   DEFAULT CHARSET=latin1
  • 写回答

1条回答 默认 最新

  • douguabu8960 2013-05-10 19:33
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 神经网络怎么把隐含层变量融合到损失函数中?
  • ¥30 自适应 LMS 算法实现 FIR 最佳维纳滤波器matlab方案
  • ¥15 lingo18勾选global solver求解使用的算法
  • ¥15 全部备份安卓app数据包括密码,可以复制到另一手机上运行
  • ¥15 Python3.5 相关代码写作
  • ¥20 测距传感器数据手册i2c
  • ¥15 RPA正常跑,cmd输入cookies跑不出来
  • ¥15 求帮我调试一下freefem代码
  • ¥15 matlab代码解决,怎么运行
  • ¥15 R语言Rstudio突然无法启动