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 6701925
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T06:59:32+00:00 2026-05-26T06:59:32+00:00

EDIT: For anyone finding this at a later date CI will use alot of

  • 0

EDIT: For anyone finding this at a later date CI will use alot of memory in these sorts of circumstances since it will create an object for every row (using result_array() doesn’t seem much better), so the best bet is just to use PHP’s built in mysql functions. If you’re using MYSQLI you can access the connection link like so:

$this->db->conn_id

I’m trying to run a script through the command line (testing for what will be a cronjob), what the script does is irrelevant since it is failing at the first select and doesn’t get any further.

I am using Codeigniter 2.0.3.

My table looks like this:

CREATE TABLE IF NOT EXISTS `graphic_files` (
  `graphic_file_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `graphic_file_style_id` tinyint(2) unsigned NOT NULL,
  `graphic_file_fm_id` bigint(20) unsigned DEFAULT NULL,
  `graphic_file_config_line` varchar(255) NOT NULL,
  `graphic_file_config_line_hash` varchar(32) NOT NULL,
  `graphic_file_location` varchar(255) DEFAULT NULL,
  `graphic_file_pack_id` int(10) unsigned NOT NULL,
  `graphic_file_enabled` tinyint(1) NOT NULL,
  `graphic_file_alternative` tinyint(1) NOT NULL,
  `graphic_file_version` decimal(4,2) NOT NULL,
  `graphic_file_time_added` int(11) unsigned NOT NULL,
  `graphic_file_time_modified` int(11) unsigned NOT NULL,
  `graphic_file_size` int(11) unsigned NOT NULL,
  PRIMARY KEY (`graphic_file_id`),
  KEY `graphic_file_style_id` (`graphic_file_style_id`),
  KEY `graphic_file_fm_id` (`graphic_file_fm_id`),
  KEY `graphic_file_config_line_hash` (`graphic_file_config_line_hash`),
  KEY `graphic_file_pack_id` (`graphic_file_pack_id`),
  KEY `graphic_file_enabled` (`graphic_file_enabled`),
  KEY `graphic_file_version` (`graphic_file_version`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=240752 ;

There are 240,000 rows.

I am trying to select around 120,000 of them with this query:

SELECT * FROM graphic_files WHERE graphic_file_enabled = 0 AND graphic_file_style_id = 5

But I get an allowed memory size error like so:

Allowed memory size of 268435456 bytes exhausted (tried to allocate 92
bytes) in
xxx/codeigniter_2.0.3/database/drivers/mysqli/mysqli_result.php on
line 167

I realise the simple answer is that i’m out of memory, but this seems ridiculous for simply doing a select query, especially with a high allowed memory size of 256mb.

Can anybody suggest a reason for this? Could it be to do with codeigniter and the way it builds the results object?

  • 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-05-26T06:59:32+00:00Added an answer on May 26, 2026 at 6:59 am

    With big data u need to use mysql resource instead of CI functions

    $result = $this->db->query($sql);
    $resource = $result->result_id;
    while($row = @mysql_fetch_assoc($resource)) {
        // do the magic
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Edit #2: Does anyone have a good method of testing the middle of a
does anyone know how you edit/maintain regions in magento - specifically adding ones for
Does anyone know how can I edit a subitem on a listView? I've tried
Does anyone have any suggestions on how to edit an <a href=''> link in
Does anyone know why there is no respond_to block for generated edit actions? Every
Question: Is anyone out there familiar enough with Komodo Edit to shed some light
edit #2: Question solved halfways. Look below As a follow-up question, does anyone know
Edit: This question was written in 2008, which was like 3 internet ages ago.
Does anyone know of a good tutorial to achieve this? (as seen here: http://www.contrastrebellion.com/
Please help me in finding the optimized solutions to these interesting data structure questions:

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.