Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Sep 2011
    Posts
    116
    Thanks
    1
    Thanked 0 Times in 0 Posts

    PDO running slow

    PDO is running extremely slow for me, however I used a pre-made database class by someone else. Which probably is the thing. For example when I try to list my users in the database. It takes over a second!

    I don't know if my localhost has something to do with it too?

    However the code I execute:

    PHP Code:
    include('database.class.php');
    $db = new Database();
    $results $db->query("SELECT * FROM users"); 

    Database class:
    https://github.com/indieteq/PHP-MySQ...r/Db.class.php

    Thanks in advance

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    You can always expect PDO to run slower than the mysqli extension. That's the tradeoff you get between abstract versus concrete implementation. The binding in this class is a bit unusual IMO since PDO handles binding far better than the mysqli does.

    The query function executes a fetchAll command. The recordset size is the determining factor on the duration of the execution since it shoves everything into an array. That alone could be your issue.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 
    Been gone for a few months, and haven't programmed in that long of a time. Meh, I'll wing it ;)

  • #3
    Regular Coder
    Join Date
    Sep 2011
    Posts
    116
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Hmm okay, I'll go look for a solution then. Learn from other PDO classes and such.

    Thank you!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •