note 24716 modified in function.ocisetprefetch by sixd

From: Date: Mon, 05 Oct 2009 03:58:03 +0000
Subject: note 24716 modified in function.ocisetprefetch by sixd
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-161337@lists.php.net to get a copy of this message
[Editor's note: if you set it to 2, PHP fetches 3 rows because the prefetch count is the number of extra rows fetched] If you set this to 2, then PHP would fetch 2 rows from the database at a time and only need to make half as many calls to the database. If you set it to 3 then 1/3 as many calls, etc. Basically this tells how many rows to retrieve at a time from the server (they will be cached so you'll still only get one at a time in your program). The drawback would be as one person already stated...the higher the number the more memory will be used. You would call this right after your parse, and before any fetch or execute. In practice this should improve performance but I haven't noticed any difference regardless of what values I put in though I am using a SQLNet interface to RDB so that may be it (for example, prefetch will not work with Oracle 7). You may have better luck than I. If you want further info try searching in google for OCI_ATTR_PREFETCH_ROWS --was-- If you set this to 2, then PHP would fetch 2 rows from the database at a time and only need to make half as many calls to the database. If you set it to 3 then 1/3 as many calls, etc. Basically this tells how many rows to retrieve at a time from the server (they will be cached so you'll still only get one at a time in your program). The drawback would be as one person already stated...the higher the number the more memory will be used. You would call this right after your parse, and before any fetch or execute. In practice this should improve performance but I haven't noticed any difference regardless of what values I put in though I am using a SQLNet interface to RDB so that may be it (for example, prefetch will not work with Oracle 7). You may have better luck than I. If you want further info try searching in google for OCI_ATTR_PREFETCH_ROWS http://php.net/manual/en/function.ocisetprefetch.php

« previous php.notes (#161337) next »