Three to four hours at the market should be enough but if you wish to spend the night there is a sampling of homestays and small hotels to choose from. Also keep in mind crowds get dense late in the day when Thai shoppers come out from hiding in the shade.