"; set_time_limit(0); $query_sql="SELECT t0.serwsa AS SERWSA_1, t0.codwsa AS CODWSA_2, t0.typart AS TYPART_3, t0.sermsuart AS SERMSUART_4, t0.flgcre AS FLGCRE_5, t0.flgmod AS FLGMOD_6, t0.flgsup AS FLGSUP_7, t0.codmtr AS CODMTR_8, t0.datmtr AS DATMTR_9, t0.datsys AS DATSYS_10, t0.serart AS SERART_11, t12.serart AS SERART_13, t12.typart AS TYPART_14, t12.numart AS NUMART_15, t12.serartgen AS SERARTGEN_16, t12.artweb AS ARTWEB_17, t12.libfra AS LIBFRA_18, t12.liball AS LIBALL_19, t12.libeng AS LIBENG_20, t12.oriart AS ORIART_21, t12.codvis AS CODVIS_22, t12.cofunt21 AS COFUNT21_23, t12.cofunt31 AS COFUNT31_24, t12.cofuntven AS COFUNTVEN_25, t12.cofmsu AS COFMSU_26, t12.poivar1 AS POIVAR1_27, t12.poivar2 AS POIVAR2_28, t12.poivar3 AS POIVAR3_29, t12.mediane AS MEDIANE_30, t12.flgstk AS FLGSTK_31, t12.gesstk AS GESSTK_32, t12.perdeb AS PERDEB_33, t12.perfin AS PERFIN_34, t12.codblo AS CODBLO_35, t12.joura AS JOURA_36, t12.heura AS HEURA_37, t12.dlvgarcli AS DLVGARCLI_38, t12.grmmin AS GRMMIN_39, t12.grmmax AS GRMMAX_40, t12.grmplr AS GRMPLR_41, t12.grmdft AS GRMDFT_42, t12.qtemin AS QTEMIN_43, t12.qtemax AS QTEMAX_44, t12.qteplr AS QTEPLR_45, t12.payint AS PAYINT_46, t12.flgdch AS FLGDCH_47, t12.flgmat AS FLGMAT_48, t12.tautva AS TAUTVA_49, t12.codtmp AS CODTMP_50, t12.catprx AS CATPRX_51, t12.prcper AS PRCPER_52, t12.codtridrv AS CODTRIDRV_53, t12.datsys AS DATSYS_54, t12.untven AS UNTVEN_55, t12.untmsu AS UNTMSU_56, t12.untweb1 AS UNTWEB1_57, t12.untweb2 AS UNTWEB2_58, t12.untweb3 AS UNTWEB3_59, t0.serwsalnk AS SERWSALNK_60 FROM twsartweb t0 LEFT JOIN twsarterp t12 ON t0.serart = t12.serart WHERE t0.codwsa IN ('460648', '702928', '774316', '706195', '708037', '708077', '707997', '798780', '702995', '725280', '710099', '798763');"; //$query_sql="SELECT t0.serimg AS SERIMG_1, t0.nomimg AS NOMIMG_2, t0.pthimg AS PTHIMG_3, t0.datsys AS DATSYS_4 FROM twsimg t0 INNER JOIN twsartimg ON t0.serimg = twsartimg.serimg WHERE twsartimg.serwsa = 8457;"; #Webshop V2 config //postgresql://webshop:xhZ5vGU46DY3h8i4@10.10.38.11:5432/webshopv2?charset=UTF-8 $PostgresqlWebshop2IP="10.10.38.11"; $PostgresqlWebshop2PORT="5432"; $PostgresqlWebshop2MainUserName="webshop"; $PostgresqlWebshop2MainUserPassword="xhZ5vGU46DY3h8i4"; $PostgresqlWebshop2MainDBName="webshopv2"; //informix://wss:KEVNEJTL8NH9@10.10.38.20:2099/webshopv2?charset=UTF-8&server=wbstcp_sla&protocol=onsoctcp&DB_LOCALE=en_US.819&CLIENT_LOCALE=en_US.utf8 $InformixWebshop2IP="10.10.38.20"; $InformixWebshop2PORT="2099"; $InformixWebshop2MainUserName="wss"; $InformixWebshop2MainUserPassword="KEVNEJTL8NH9"; $InformixWebshop2MainDBName="webshopv2"; $InformixWebshop2MainServer="wbstcp_sla"; $InformixWebshop2MainProtocol="onsoctcp"; // List of fetch styles to test $fetchStyles = array( 'Assoc' => PDO::FETCH_ASSOC, 'Both' => PDO::FETCH_BOTH, 'Lazy' => PDO::FETCH_LAZY, 'Num' => PDO::FETCH_NUM, 'Obj' => PDO::FETCH_OBJ ); try { $dsn = "pgsql:host=$PostgresqlWebshop2IP;port=$PostgresqlWebshop2PORT;dbname=$PostgresqlWebshop2MainDBName;"; // make a database connection $pdo = new PDO($dsn, $PostgresqlWebshop2MainUserName, $PostgresqlWebshop2MainUserPassword, [PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION]); if ($pdo) { echo "Connected to the POSTGRES database successfully!"; Benchmark($pdo, $query_sql, $fetchStyles); $pdo = null; } } catch (PDOException $e) { die($e->getMessage()); } try { $dsn = "informix:host=$InformixWebshop2IP;service=$InformixWebshop2PORT;database=$InformixWebshop2MainDBName;server=$InformixWebshop2MainServer;protocol=$InformixWebshop2MainProtocol;EnableScrollableCursors=0"; // make a database connection $pdo = new PDO($dsn, $InformixWebshop2MainUserName, $InformixWebshop2MainUserPassword, [PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION]); if ($pdo) { echo "Connected to the INFORMIX database successfully!"; Benchmark($pdo, $query_sql, $fetchStyles); $pdo = null; } } catch (PDOException $e) { die($e->getMessage()); } function Benchmark($pdo, $query_sql, $fetchStyles){ // The results array $result = array(); var_dump($pdo); // Loop each style foreach($fetchStyles as $key => $style) { // Total time for each style $total = 0.0; for ($i = 0; $i < 100; $i++) { // Record the start time $start = microtime(true); // Execute $statement = $pdo->prepare($query_sql); $statement->execute(); //$statement->debugDumpParams(); $mixed = $statement->fetch($style); // Record the end time $stop = microtime(true); // Convert Start and Stop to Miliseconds $start = $start * 1000.0; $stop = $stop * 1000.0; // Calculate the time taken $diff = ($stop - $start); // Add the difference to the total $total = $total + $diff; } // Store the result $result[$key] = $total; } // Sort the results asort($result, SORT_NUMERIC); // Output the result // Time taken is in Milliseconds var_dump($result); }