Jump to content

angelcool

Members
  • Posts

    160
  • Joined

  • Last visited

    Never

Posts posted by angelcool

  1. Hello community, I have requested a new feature to the PHP Group.

     

    What is this feature about?

    Dynamically populating PDF form templates using FDF/XFDF text files. The goal is the user gets to download the updated version of the PDF template.

     

    Feature requests are submitted through the bug reporting section, the feature request id is #61647. ( https://bugs.php.net/bug.php?id=61647 )

     

    Please cast your vote If you think this feature can help you someday.

     

    Angel

     

    P.S. I hope this is the right section.

  2.  

    Basically what I wanted is the opinion from someone experienced using indexes in big tables (10GB~20~30GB); I am testing MySQL, so far the test table I created reached 1.2 GB, now I can tell/feel how an index(primary key,auto increment) will increase performance for a SELECT query. The table has 10,000,00 rows, a SELECT without index (full scan) takes about 12-18 seconds with an index query the time is less than 1/4 of a second.

     

    On the other hand, I have read that the indexes will slow down the speed of writing queries (INSERT, DELETE, UPDATE), since every time a record is changed the indexes must be updated (I understand that a solution for this issue could be setting up replication and redirect all your write queries to the master and read ones to the salves ). So,  Does indexing advantages overcome writing disadvantages ?

     

    Also, what if it is a complex query that required a comparison in a non-index column in a 30GB table? You executed and go to lunch ? :shrug:

     

    Anyone out there managing a big table/DB?

     

  3. ...well the id in the table was indexed, so look all those timers!! DB is now 1.2GB with 10,000,000 rows!

    mysql> select * from RandomNumbers where id=9800000;

    +---------+----------------------------------+----------------------------------+----------------------------------+

    | id      | random1                          | random2                          | random3                          |

    +---------+----------------------------------+----------------------------------+----------------------------------+

    | 9800000 | ED2ZBWTEGSRVTXZWF9XZ1WW3P71QR72V | AULBG5FNMW97KZTQYGGQ43IIZAZH7R48 | BF9IBEWN2WLDL6UAD1R7UZGKZ6SXNLVP |

    +---------+----------------------------------+----------------------------------+----------------------------------+

    1 row in set (0.00 sec)

     

    mysql> select * from RandomNumbers where id=1205254;

    +---------+----------------------------------+----------------------------------+----------------------------------+

    | id      | random1                          | random2                          | random3                          |

    +---------+----------------------------------+----------------------------------+----------------------------------+

    | 1205254 | XPHACFYG32422DXCCH155RE892AVEEZ2 | 5KR22ZUFYNUU8TRZRL6MR4SZLC14RRIL | 2ZETPYZEDKZB4H2KUXYCSH24JTY2A8D3 |

    +---------+----------------------------------+----------------------------------+----------------------------------+

    1 row in set (0.00 sec)

     

    mysql> select * from RandomNumbers where id=9800000;

    +---------+----------------------------------+----------------------------------+----------------------------------+

    | id      | random1                          | random2                          | random3                          |

    +---------+----------------------------------+----------------------------------+----------------------------------+

    | 9800000 | ED2ZBWTEGSRVTXZWF9XZ1WW3P71QR72V | AULBG5FNMW97KZTQYGGQ43IIZAZH7R48 | BF9IBEWN2WLDL6UAD1R7UZGKZ6SXNLVP |

    +---------+----------------------------------+----------------------------------+----------------------------------+

    1 row in set (0.00 sec)

     

    mysql> select * from RandomNumbers where id=8205254;

    +---------+----------------------------------+----------------------------------+----------------------------------+

    | id      | random1                          | random2                          | random3                          |

    +---------+----------------------------------+----------------------------------+----------------------------------+

    | 8205254 | B3D2SFYPYVF898RSA9AFLN1G5TYF3VF5 | PJW8PKMD7SC7RUPRTPX64PCZ8252MAW3 | JI1ZUD4RW6PDR4VBJJ7DYA3W2YPFZC8A |

    +---------+----------------------------------+----------------------------------+----------------------------------+

    1 row in set (0.00 sec)

     

    mysql> select count(*) from RandomNumbers;         

    +----------+

    | count(*) |

    +----------+

    | 10047282 |

    +----------+

    1 row in set (0.00 sec)

     

    mysql> explain select count(*) from RandomNumbers;

    +----+-------------+-------+------+---------------+------+---------+------+------+------------------------------+

    | id | select_type | table | type | possible_keys | key  | key_len | ref  | rows | Extra                        |

    +----+-------------+-------+------+---------------+------+---------+------+------+------------------------------+

    |  1 | SIMPLE      | NULL  | NULL | NULL          | NULL | NULL    | NULL | NULL | Select tables optimized away |

    +----+-------------+-------+------+---------------+------+---------+------+------+------------------------------+

    1 row in set (0.00 sec)

     

    mysql> explain select count(*) from RandomNumbers where id=4589002;

    +----+-------------+---------------+-------+---------------+---------+---------+-------+------+-------------+

    | id | select_type | table        | type  | possible_keys | key    | key_len | ref  | rows | Extra      |

    +----+-------------+---------------+-------+---------------+---------+---------+-------+------+-------------+

    |  1 | SIMPLE      | RandomNumbers | const | PRIMARY      | PRIMARY | 8      | const |    1 | Using index |

    +----+-------------+---------------+-------+---------------+---------+---------+-------+------+-------------+

    1 row in set (0.09 sec)

     

    mysql>

     

     

  4. 
    mysql> explain extended select count(*) from RandomNumbers where random1='XPHACFYG22422DXCCH155RE682AVEEZ2';
    +----+-------------+---------------+------+---------------+------+---------+------+---------+-------------+
    | id | select_type | table         | type | possible_keys | key  | key_len | ref  | rows    | Extra       |
    +----+-------------+---------------+------+---------------+------+---------+------+---------+-------------+
    |  1 | SIMPLE      | RandomNumbers | ALL  | NULL          | NULL | NULL    | NULL | 5797265 | Using where | 
    +----+-------------+---------------+------+---------------+------+---------+------+---------+-------------+
    1 row in set, 1 warning (0.07 sec)
    
    mysql> 
    
    
    
    

     

    No, the explain plan showed exactly what we stated... it is doing a full table scan of the table.

     

    What column in the explain indicates the full scan ?

  5. mysql> select count(*) from RandomNumbers where random1='XPHACFYG22422DXCCH155RE682AVEEZ2';
    +----------+
    | count(*) |
    +----------+
    |        1 | 
    +----------+
    1 row in set (3.60 sec)
    
    
    

     

     

    ...mm 3.6 secs, it's  almost a 6,000,000  rows table tho. OK, I admit it, it's 32 bit CentOS running in VirtualBox; perhaps with dedicated server hardware query time will decrease.

  6. mysql> explain SELECT * FROM RandomNumbers WHERE random1='XPHACFYG22422DXCCH155RE682AVEEZ2' AND random2='T83WDR36JXYC1LE4U5YPM3LKUM7ZRWSB' AND random3='UKXY3QVCEJF5VJZGFNVSG842L1R4MA58';
    +----+-------------+---------------+------+---------------+------+---------+------+---------+-------------+
    | id | select_type | table         | type | possible_keys | key  | key_len | ref  | rows    | Extra       |
    +----+-------------+---------------+------+---------------+------+---------+------+---------+-------------+
    |  1 | SIMPLE      | RandomNumbers | ALL  | NULL          | NULL | NULL    | NULL | 5797265 | Using where | 
    +----+-------------+---------------+------+---------------+------+---------+------+---------+-------------+
    
    
    
    mysql> SELECT * FROM RandomNumbers WHERE random1='XPHACFYG22422DXCCH155RE682AVEEZ2' AND random2='T83WDR36JXYC1LE4U5YPM3LKUM7ZRWSB' AND random3='UKXY3QVCEJF5VJZGFNVSG842L1R4MA58';
    +---------+----------------------------------+----------------------------------+----------------------------------+
    | id      | random1                          | random2                          | random3                          |
    +---------+----------------------------------+----------------------------------+----------------------------------+
    | 5297215 | XPHACFYG22422DXCCH155RE682AVEEZ2 | T83WDR36JXYC1LE4U5YPM3LKUM7ZRWSB | UKXY3QVCEJF5VJZGFNVSG842L1R4MA58 | 
    +---------+----------------------------------+----------------------------------+----------------------------------+
    1 row in set (3.77 sec)
    
    
    

    )

     

    Table now is 685 MB.

     

     

  7. Try something like:

    <?php
        $log_file= file_get_contents("ftp://username:password@68.232.164.100/czero/68.232.164.100:27015/czero/gsconsole.log"); 
    
    ?>
    <textarea name="log_view" cols="110" rows="20" readonly="readonly" wrap="virtual"><?php echo $log_file; ?></textarea>
    

     

    You might have to urlencode your URI.

  8. php does not crash.

    That's your excuse? It must be okay because the computer doesn't explode when you do it?

     

    Using global variables makes it that much easier to

    1. Introduce bugs in your script. All of a sudden you can't use certain names for variables.

    2. Introduce magic functionality that relies on some special behavior from PHP. The old session 42 bug was like that.

    3. Create security holes. If you assume things that aren't true, malicious users can and will use that against you.

    4. Write confusing code. Sure, you can read it and understand how it works, but can anybody else?

    5. Develop bad coding practices that are completely useless, if even allowed, in other languages. And before you say "I'll always write PHP", open up your mind and think of your career (assuming you want one in web development).

     

    ...you should forward all that to PHP team to get rid of the global keyword.

  9. cookies? I cannot think of anything else.

     

     

    My understanding is that when you close your browser your SESSION ID will be different next time you open your browser, thus you will need to login again, so:

     

    1. Login

    2. close browser

    3. open browser again

    4. log in required

     

    if the above behavior is happening, then everything OK. But if your are failing to log in again (step 4 will not log u in) , your code is got ISSUES.

     

×
×
  • 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.