Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8384093
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T17:19:23+00:00 2026-06-09T17:19:23+00:00

I created a table with MySQL partition by hash(to_days(…)) . CREATE TABLE `requestlog` (

  • 0

I created a table with MySQL partition by hash(to_days(...)).

CREATE TABLE `requestlog` (
  `remotehost` varchar(40) DEFAULT NULL,
  `user` varchar(255) DEFAULT NULL,
  `request_time_str` varchar(40) DEFAULT NULL,
  `request_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `request_line` varchar(255) DEFAULT NULL,
  `status` int(11) DEFAULT NULL,
  `bytes` int(11) DEFAULT NULL,
  `referer` text,
  `useragent` text,
  `host` text,
  `instance` text,
  `ms` int(11) DEFAULT NULL,
  `cpu_ms` int(11) DEFAULT NULL,
  `api_cpu_ms` int(11) DEFAULT NULL,
  `cpm_usd` float DEFAULT NULL,
  `queue_name` varchar(40) DEFAULT NULL,
  `task_name` varchar(40) DEFAULT NULL,
  `loading_request` tinyint(1) DEFAULT NULL,
  `pending_ms` int(11) DEFAULT NULL,
  `exit_code` int(11) DEFAULT NULL,
  `throttle_code` int(11) DEFAULT NULL,
  `method` varchar(40) DEFAULT NULL,
  `path` varchar(255) DEFAULT NULL,
  `querystring` text,
  `protocol` varchar(40) DEFAULT NULL,
  `applog` text,
  `applog0` text,
  `applog1` text,
  `applog2` text,
  `applog3` text,
  `applog4` text,
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `updated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMES
TAMP,
  PRIMARY KEY (`request_time`,`id`),
  UNIQUE KEY `path` (`path`,`request_time`,`remotehost`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8
/*!50100 PARTITION BY HASH (to_days(request_time))
PARTITIONS 1000 */

However while I execute the following query. the explain partitions result shows the partition pruning not work because it scans all partitions belong to this table…

explain partitions select count(*) from requestlog where to_days(request_time) = '2012-08-01';

I tried the sample in this article. the explain partitions still shows it scan all partitions.
how to partition a table by datetime column?

How to let the partition pruning works? Any hints?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T17:19:25+00:00Added an answer on June 9, 2026 at 5:19 pm

    try this without to_days:

    explain partitions select count(*) from requestlog where request_time = '2012-08-01';
    

    EDIT:

    explain partitions 
            select count(*) 
            from requestlog 
            where request_time BETWEEN '2012-08-01 00:00:00' AND '2012-08-01 23:59:59';
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In this MySQL table definition: CREATE TABLE groups ( ug_main_grp_id smallint NOT NULL default
assume I already created a table in MySQL as below CREATE TABLE IF NOT
i have created a table in mysql to store polygon data: CREATE TABLE geom
I created a table in a MySQL database via the following: CREATE TABLE `newsubscriptions_orderspecification`
I have an ISAm table in mySql that was created similar to this: create
I have a table successfully created in MySQL: CREATE TABLE IF NOT EXISTS MESSAGE
I have table in mysql with MyISAM storage engine. I want to create partition
I have an MySQL table: CREATE TABLE responses ( id INT NOT NULL AUTO_INCREMENT,
I have created a MySQL table and would like to save the contents of
I previously created a MySQL table and now I want to find out what

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.